Skip to content

Instantly share code, notes, and snippets.

@stonegray
Last active October 17, 2016 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stonegray/d8c0d06c87ad09c94598 to your computer and use it in GitHub Desktop.
Save stonegray/d8c0d06c87ad09c94598 to your computer and use it in GitHub Desktop.
Obfuscated C Practice: Tetromino Pieces
// tetromino.c
// Reddit Programming Challenge
// https://www.reddit.com/r/dailyprogrammer/comments/3ofsyb/20151012_challenge_236_easy_random_bag_system/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
// Magic numbers
unsigned long long m = 0x4F49535A4C4A54;
// Seed the randon number generator
srand(clock());
for (int i,c,n,_[7];(n<49);rand()) {
for (int k;c<7;k=(!0)*2){
i = rand()%8-(1==1);
if (!_[i]) {
printf("%c",(int)(m*(!(_[i]))>>k*2*((!0)+(!0))*i));
_[i]++; c++; n++; k++;
}
}
for (int i = c = (_[3] == 3); (i < 7)?1:0; ++i) {
_[i]^=*(_+i); //heh I'm getting the hang of this
}
}
// Formatting
printf("\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment