M[16],X=16,W,k;main(){T(system("stty cbreak") | |
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i | |
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M | |
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<< | |
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k) | |
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d | |
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X] | |
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4; | |
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4|| | |
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2 | |
||read(0,&k,3)|T(s (1,K[(k>>X)%4]));}//[2048] |
This comment has been minimized.
This comment has been minimized.
LOL. I am impressed. You could get a job at Twitter with these algorithm skills. (I'm assuming it works haha) |
This comment has been minimized.
This comment has been minimized.
Very nice! It works great. If someone takes the time to reformat the code, post it in another gist? It would be nice to see what makes it tick. |
This comment has been minimized.
This comment has been minimized.
Just when I kicked my addiction.. |
This comment has been minimized.
This comment has been minimized.
https://gist.github.com/anirudh-chhangani/9989292 |
This comment has been minimized.
This comment has been minimized.
gcc give warnings but it compile and work. Nice. |
This comment has been minimized.
This comment has been minimized.
This is very impressive! So is your tiny Conways game of life, brilliant! |
This comment has been minimized.
This comment has been minimized.
Impressive, but it lets me execute invalid moves. |
This comment has been minimized.
This comment has been minimized.
This is great, works fine in devcpp on windows. |
This comment has been minimized.
This comment has been minimized.
Quite a few warnings from gcc but seems to work fine.... good job! |
This comment has been minimized.
This comment has been minimized.
Cool. |
This comment has been minimized.
This comment has been minimized.
This is super cool. Great job :) |
This comment has been minimized.
This comment has been minimized.
Obfuscated. I mean cool. |
This comment has been minimized.
This comment has been minimized.
我擦, 太niubility了 |
This comment has been minimized.
This comment has been minimized.
我擦, 太niubility了 |
This comment has been minimized.
This comment has been minimized.
我擦, 太niubility了 |
This comment has been minimized.
This comment has been minimized.
我擦, 太niubility了 |
This comment has been minimized.
This comment has been minimized.
我擦, 太niubility了 |
This comment has been minimized.
This comment has been minimized.
This is great! One issue is that when you execute an invalid move (i.e. a move that should not cause anything to move) a new tile is spawned. |
This comment has been minimized.
This comment has been minimized.
This is by far the coolest implementation of the 2048 game. Pure Awesome! |
This comment has been minimized.
This comment has been minimized.
works on mac. nice! |
This comment has been minimized.
This comment has been minimized.
Just played the game on terminal. Nice one dude. |
This comment has been minimized.
This comment has been minimized.
Woah! |
This comment has been minimized.
This comment has been minimized.
Great, nice work. hughrawlinson is correct though |
This comment has been minimized.
This comment has been minimized.
wow~ |
This comment has been minimized.
This comment has been minimized.
so niubility. |
This comment has been minimized.
This comment has been minimized.
awesome and great. |
This comment has been minimized.
This comment has been minimized.
This is legit. |
This comment has been minimized.
This comment has been minimized.
awesome work |
This comment has been minimized.
This comment has been minimized.
fantastic |
This comment has been minimized.
This comment has been minimized.
nice! |
This comment has been minimized.
This comment has been minimized.
greart! |
This comment has been minimized.
This comment has been minimized.
I'm slow ╮(╯▽╰)╭ |
This comment has been minimized.
This comment has been minimized.
Incredible |
This comment has been minimized.
This comment has been minimized.
很不错哦。 |
This comment has been minimized.
This comment has been minimized.
干得漂亮! |
This comment has been minimized.
This comment has been minimized.
very excellent job! |
This comment has been minimized.
This comment has been minimized.
Nice work! Very impressive! Reformatted code. https://gist.github.com/Crimx/10001638 |
This comment has been minimized.
This comment has been minimized.
Cool |
This comment has been minimized.
This comment has been minimized.
Nice |
This comment has been minimized.
This comment has been minimized.
Awesome! |
This comment has been minimized.
This comment has been minimized.
WoW. |
This comment has been minimized.
This comment has been minimized.
Good Job! |
This comment has been minimized.
This comment has been minimized.
Good Job! |
This comment has been minimized.
This comment has been minimized.
Nice Job Dude :) |
This comment has been minimized.
This comment has been minimized.
why read(0,&k,3)? the arrow keys only need 2bytes. |
This comment has been minimized.
This comment has been minimized.
good job !!! |
This comment has been minimized.
This comment has been minimized.
cool~~ |
This comment has been minimized.
This comment has been minimized.
There is a small bug in this implementation: Example: |
This comment has been minimized.
This comment has been minimized.
good job! |
This comment has been minimized.
This comment has been minimized.
awesome! |
This comment has been minimized.
This comment has been minimized.
cool...so niubility |
This comment has been minimized.
This comment has been minimized.
loool fantastic :)) |
This comment has been minimized.
This comment has been minimized.
干的漂亮 |
This comment has been minimized.
This comment has been minimized.
干的漂亮 |
This comment has been minimized.
This comment has been minimized.
饿妹子樱! |
This comment has been minimized.
This comment has been minimized.
It is more like horse shoes than golf. Maybe if there was some code hand grenading contest. |
This comment has been minimized.
This comment has been minimized.
WoW 8O |
This comment has been minimized.
This comment has been minimized.
Compiled successfully using MinGW and VC11 but unusable. |
This comment has been minimized.
This comment has been minimized.
Nice job |
This comment has been minimized.
This comment has been minimized.
马上有牛! |
This comment has been minimized.
This comment has been minimized.
Nice job. +1 |
This comment has been minimized.
This comment has been minimized.
Awesome! |
This comment has been minimized.
This comment has been minimized.
Awesome! |
This comment has been minimized.
This comment has been minimized.
碉堡了 |
This comment has been minimized.
This comment has been minimized.
This is awsome, works well on mac!! |
This comment has been minimized.
This is awesome! Could you also post the unminified code?