Skip to content

Instantly share code, notes, and snippets.

Created April 4, 2014 03:49
Show Gist options
  • Save justecorruptio/9967738 to your computer and use it in GitHub Desktop.
Save justecorruptio/9967738 to your computer and use it in GitHub Desktop.
Tiny 2048 in C!
M[16],X=16,W,k;main(){T(system("stty cbreak")
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
||read(0,&k,3)|T(s (1,K[(k>>X)%4]));}//[2048]
Copy link

balaziks commented Apr 6, 2014

There is a small bug in this implementation:
When there is nothing to move in some direction but I press the arrow to that direction it'll spawn new tile. Original 2048 wouldn't let me do this.

After arrow-down:

Copy link

k1ll4m3 commented Apr 6, 2014

good job!

Copy link

sadid commented Apr 6, 2014

it has a warning (gcc) but works...amazing

Copy link

djlinks commented Apr 6, 2014 niubility

Copy link

amad commented Apr 6, 2014

loool fantastic :))

Copy link

yifanes commented Apr 7, 2014


Copy link


Copy link

kunahe commented Apr 7, 2014


Copy link

armagad commented Apr 7, 2014

It is more like horse shoes than golf.

Maybe if there was some code hand grenading contest.

Copy link

moham commented Apr 8, 2014

WoW 8O
very impressive!

Copy link

xdqi commented Apr 11, 2014

Compiled successfully using MinGW and VC11 but unusable.

Copy link

Nice job

Copy link


Copy link

oxUnd commented Jun 27, 2015

Nice job. +1

Copy link


Copy link

findo commented Jun 27, 2015


Copy link


Copy link

jagosw commented Apr 23, 2016

This is awsome, works well on mac!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment