Create a gist now

Instantly share code, notes, and snippets.

Embed
Tiny 2048
import os,tty;tty.setcbreak(0);M=['']*16
def G(v):
p=['']*4;u=list(filter(str,v));i=3
while u:z=u.pop();p[i]=u and z==u[-1]and 2*u.pop()or z;i-=1
return p
def Y(M,k):i=1;M=zip(*[iter(M)]*4);exec'M=map([list,G][i*k==k*k],zip(*M))[::-1];i+=1;'*4;return sum(M,[])
while 1:
r=id(M)%71+17
while M[r%16]*r:r-=1
if r:M[r%16]=r%7%2*2+2
J="WIN"*(2048in M)or"LOSE"*all(Y(M,0));print'\x1b[2J\x1b[H'+('%4s|'*4+'\n')*4%tuple(M)+J
if J:break
M=Y(M,">BDAC".find(os.read(0,3)[2]))
@maxgutman

This comment has been minimized.

Show comment
Hide comment
@maxgutman

maxgutman Mar 20, 2014

Very impressive Jay!

Very impressive Jay!

@cetanu

This comment has been minimized.

Show comment
Hide comment
@cetanu

cetanu Mar 21, 2014

dat golf

cetanu commented Mar 21, 2014

dat golf

@TankCool

This comment has been minimized.

Show comment
Hide comment
@TankCool

TankCool Apr 6, 2014

WoW!

TankCool commented Apr 6, 2014

WoW!

@yottanami

This comment has been minimized.

Show comment
Hide comment
@yottanami

yottanami Apr 6, 2014

Perfect

Perfect

@mehdico

This comment has been minimized.

Show comment
Hide comment
@mehdico

mehdico Apr 6, 2014

good. are you use any obfuscator or automatic code optimizer tool ?

mehdico commented Apr 6, 2014

good. are you use any obfuscator or automatic code optimizer tool ?

@ctian1

This comment has been minimized.

Show comment
Hide comment
@ctian1

ctian1 Apr 30, 2014

Is this for python 3.3? If not, can you make one?

ctian1 commented Apr 30, 2014

Is this for python 3.3? If not, can you make one?

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