Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#C,177

C,177

f(r){r=rand()%24;r=(5545>>r%4*3&63^256-(r*2&8))*513>>r/8*3;printf(" ________\n /\\%9s / \\%4d \\\n{ %d }-------}\n \\ /%4d /\n \\/_______/","\\\n",7&r,7&r/8,7&r/64);}

In test program

f(r){r=rand()%24;
r=(5545>>r%4*3&63^256-(r*2&8))*513>>r/8*3;
printf(" ________\n /\\%9s / \\%4d \\\n{ %d }-------}\n \\ /%4d /\n \\/_______/","\\\n",7&r,7&r/8,7&r/64);}
j;
main(){
 for(j=99;j--;puts(""))f();
}

Explanation

r= \\after calculation, assign to r (in order to use only one variable.)
(5545>>r%4*3&63 \5545円 is 12651 in octal. Select 2 digts for the equator
^256-(r*2&8)) \\if 4's bit of r is 0, prepend 4=256/64. Else prepend 3 and reverse one of the faces by xoring with 7. 256-8 = 248 = 3*64+7*8.
*513 \\now we have a 3 digit octal number. duplicate all digits by multiplying by 1001 octal.
>>r/8*3 \\rightshift 0,1 or 2 digits to rotate. 

#C,177

f(r){r=rand()%24;r=(5545>>r%4*3&63^256-(r*2&8))*513>>r/8*3;printf(" ________\n /\\%9s / \\%4d \\\n{ %d }-------}\n \\ /%4d /\n \\/_______/","\\\n",7&r,7&r/8,7&r/64);}

In test program

f(r){r=rand()%24;
r=(5545>>r%4*3&63^256-(r*2&8))*513>>r/8*3;
printf(" ________\n /\\%9s / \\%4d \\\n{ %d }-------}\n \\ /%4d /\n \\/_______/","\\\n",7&r,7&r/8,7&r/64);}
j;
main(){
 for(j=99;j--;puts(""))f();
}

Explanation

r= \\after calculation, assign to r (in order to use only one variable.)
(5545>>r%4*3&63 \5545円 is 12651 in octal. Select 2 digts for the equator
^256-(r*2&8)) \\if 4's bit of r is 0, prepend 4=256/64. Else prepend 3 and reverse one of the faces by xoring with 7. 256-8 = 248 = 3*64+7*8.
*513 \\now we have a 3 digit octal number. duplicate all digits by multiplying by 1001 octal.
>>r/8*3 \\rightshift 0,1 or 2 digits to rotate. 

C,177

f(r){r=rand()%24;r=(5545>>r%4*3&63^256-(r*2&8))*513>>r/8*3;printf(" ________\n /\\%9s / \\%4d \\\n{ %d }-------}\n \\ /%4d /\n \\/_______/","\\\n",7&r,7&r/8,7&r/64);}

In test program

f(r){r=rand()%24;
r=(5545>>r%4*3&63^256-(r*2&8))*513>>r/8*3;
printf(" ________\n /\\%9s / \\%4d \\\n{ %d }-------}\n \\ /%4d /\n \\/_______/","\\\n",7&r,7&r/8,7&r/64);}
j;
main(){
 for(j=99;j--;puts(""))f();
}

Explanation

r= \\after calculation, assign to r (in order to use only one variable.)
(5545>>r%4*3&63 \5545円 is 12651 in octal. Select 2 digts for the equator
^256-(r*2&8)) \\if 4's bit of r is 0, prepend 4=256/64. Else prepend 3 and reverse one of the faces by xoring with 7. 256-8 = 248 = 3*64+7*8.
*513 \\now we have a 3 digit octal number. duplicate all digits by multiplying by 1001 octal.
>>r/8*3 \\rightshift 0,1 or 2 digits to rotate. 
added 234 characters in body
Source Link
Level River St
  • 28.8k
  • 4
  • 40
  • 112

#C,190 including unnecessary returns. Will golf later177

r;s;
f(r){r=rand()%24;
s=%24;r=(10082>>r%4*3&63^5545>>r%4*3&63^256-(r&4?64:440r*2&8))*513>>r/8*3;
printf8*3;printf(" ________\n /\\ \\%9s / \\%4d \\\n{ %d }-------}\n \\ /%4d /\n \\/_______/","\\\n",7&r,7&r/8,7&r/64);}

In test program

f(r){r=rand()%24;
r=(5545>>r%4*3&63^256-(r*2&8))*513>>r/8*3;
printf(" %d________\n /\\%9s / \\%4d  \\\n{ %d }-------}\n \\ / %d%4d /\n \\/_______/",7&s"\\\n",7&s7&r,7&r/8,7&s7&r/64);}
j;
main(){
 for(j=99;j--;puts(""))f();
}

ExplanationExplanation

s=r= \\after calculation, assign to r (10082>>r%4*3&63in order to use \10082円only one variable.)
(5545>>r%4*3&63  \5545円 is 2354212651 in octal. Select 2 digts for the equator
^^256-(r&4?64:440r*2&8)) \\if 4's bit of r is 10, prepend 14=256/64. Else prepend 63 and reverse one of the faces by xoring with 7. 440256-8 = 6*64248 += 7*83*64+7*8.
*513 \\now we have a 3 digit octal number. duplicate all digits by multiplying by 1001 octal.
>>r/8*3 \\rightshift 0,1 or 2 digits to rotate. 

#C,190 including unnecessary returns. Will golf later

r;s;
f(){r=rand()%24;
s=(10082>>r%4*3&63^(r&4?64:440))*513>>r/8*3;
printf(" ________\n /\\  \\\n / \\ %d \\\n{ %d }-------}\n \\ / %d /\n \\/_______/",7&s,7&s/8,7&s/64);}

Explanation

s=(10082>>r%4*3&63 \10082円 is 23542 in octal. Select 2 digts for the equator
^(r&4?64:440)) \\if 4's bit of r is 1, prepend 1. Else prepend 6 and reverse one of the faces by xoring with 7. 440 = 6*64 + 7*8.
*513 \\now we have a 3 digit octal number. duplicate all digits by multiplying by 1001 octal.
>>r/8*3 \\rightshift 0,1 or 2 digits to rotate. 

#C,177

f(r){r=rand()%24;r=(5545>>r%4*3&63^256-(r*2&8))*513>>r/8*3;printf(" ________\n /\\%9s / \\%4d \\\n{ %d }-------}\n \\ /%4d /\n \\/_______/","\\\n",7&r,7&r/8,7&r/64);}

In test program

f(r){r=rand()%24;
r=(5545>>r%4*3&63^256-(r*2&8))*513>>r/8*3;
printf(" ________\n /\\%9s / \\%4d  \\\n{ %d }-------}\n \\ /%4d /\n \\/_______/","\\\n",7&r,7&r/8,7&r/64);}
j;
main(){
 for(j=99;j--;puts(""))f();
}

Explanation

r= \\after calculation, assign to r (in order to use only one variable.)
(5545>>r%4*3&63  \5545円 is 12651 in octal. Select 2 digts for the equator
^256-(r*2&8)) \\if 4's bit of r is 0, prepend 4=256/64. Else prepend 3 and reverse one of the faces by xoring with 7. 256-8 = 248 = 3*64+7*8.
*513 \\now we have a 3 digit octal number. duplicate all digits by multiplying by 1001 octal.
>>r/8*3 \\rightshift 0,1 or 2 digits to rotate. 
Source Link
Level River St
  • 28.8k
  • 4
  • 40
  • 112

#C,190 including unnecessary returns. Will golf later

r;s;
f(){r=rand()%24;
s=(10082>>r%4*3&63^(r&4?64:440))*513>>r/8*3;
printf(" ________\n /\\ \\\n / \\ %d \\\n{ %d }-------}\n \\ / %d /\n \\/_______/",7&s,7&s/8,7&s/64);}

Explanation

s=(10082>>r%4*3&63 \10082円 is 23542 in octal. Select 2 digts for the equator
^(r&4?64:440)) \\if 4's bit of r is 1, prepend 1. Else prepend 6 and reverse one of the faces by xoring with 7. 440 = 6*64 + 7*8.
*513 \\now we have a 3 digit octal number. duplicate all digits by multiplying by 1001 octal.
>>r/8*3 \\rightshift 0,1 or 2 digits to rotate. 

AltStyle によって変換されたページ (->オリジナル) /