// The intent of this variation is to manifest the symmetries in the pieces. #include #include typedef unsigned short us; us const p[] = {0xffff, 0x039f, 0xf2f2, 0xf9c8, 0xf900, 0xb0f0}; // 16+8+10+9+6+7 = 56 char rn[] = {0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15}; us turn(us px){ return ((px &0xf)<< 4) //1302 rotate piece 90 about long axis | (((px>> 4) )<<12) | ((px>> 8)&0xf) | (((px>>12)&0xf)<< 8);} us tb(us px){ return ((us)rn[ px &0xf]<< 8) //2301 rotate piece 180 about short axis | ((us)rn[(px>> 4)&0xf]<<12) | (us)rn[(px>> 8)&0xf] | ((us)rn[(px>>12) ]<< 4);} us ref(us px){ // chiral reflection return ((px&0xff)<< 8)|(px>>8);} int main(){ int cnt = 0; int j; for(j=1; j<6; ++j){us x = p[j]; {int k = 2; while(k--) {x = ref(x); {int l = 4; while(l--) {x = turn(x); {int n = 2; while(n--) {x = tb(x); {int c=6; while(c--) if((x == p[c]) // is this the same as some other piece? && (k | l | n)) // but not the identity case. printf ("Sym %d %d %d %d %d\n", j, k, l, n, c); else ++cnt;}}}}}} if(x != p[j]) printf("fault %d %d\n", j, k);}} printf("Bye %d\n", cnt); return 0;} /* Yield on 2008 Feb 9. Sym 2 1 0 0 2 Sym 4 1 0 1 4 Bye 478 */