fork download
  1. #define X" YYY \n"
  2. #define Y"BBBRRRGGGOOO\n"
  3. #define Z" WWW \n"
  4. char*a,k;*d,*j,r,p,q,s;f(g,h)int*g;{for(j=g;g+h-j;a[*j]=k,j+=h<0?-1:1)for(k=a[j[r=3*h]];r;a[j[r+h]]=a[j[r]])r-=h;}l(g,m){f(d+g*8+m*7,m?-2:2);f(d+48+g*12+m*11,m?-3:3);}n(char*o){char A[]=X X X Y Y Y Z Z Z;int D[]=L"\3\4\5\22\37\36\35\20'()6CBA4*+,9FED7-./<IHG:012?LKJ=QRS`mlk^210/.-,+*)('\3\20\35*7DQ^kL?2\35\36\37-:GSRQC6)m`SF9,\37\22\5\60=J'4AklmI</\5\4\3ABCDEFGHIJKL";a=A;for(d=D;q=*o;q&&l(p,0))p=q-85?q-76?q-70?q-82?q-66?q-68?p:5:4:3:2:1:0,s=*++o==39|*o=='i',q=*o==50,o+=s|q,l(p,s);puts(a);}
  5.  
  6. int main() {
  7. n("U2D2R2L2F2B2"); //checker cube
  8. n("UDiRL'FBiUD'"); //spotted cube
  9. }
Success #stdin #stdout 0s 4488KB
stdin
Standard input is empty
stdout
   YWY      
   WYW      
   YWY      
BGBRORGBGORO
GBGOROBGBROR
BGBRORGBGORO
   WYW      
   YWY      
   WYW      

   RRR      
   RYR      
   RRR      
WWWGGGYYYBBB
WBWGRGYGYBOB
WWWGGGYYYBBB
   OOO      
   OWO      
   OOO