Random game
Random software
Random demo
Short description
2047 is a remake of 2048, created for the "NOMAM Basic Ten-Liners 2014" competition. The entire code, written in the Turbo Basic XL language, is 10 lines long. The game takes place on a 4x4 grid and begins with one tile with the number 2. The player uses arrow keys to move the tiles, with a new "2" tile appearing after every move. When two tiles with the same number collide, they combine into one tile with the next power of two, e.g. two tiles with 16 will give a 32 tile. The goal is to get as valuable a tile as possible. The game is over if the entire board is filled. Link to description source
2047 2047 2047 2047 2047 2047 2047 2047
Listing 1
0 GRAPHICS %0:​V=DPEEK($58):​W=V:​POKE $52,​%0:​MOVE $E000,​$B400,​$0400:​MOVE ADR("9999??999?????99999999??"),​$B470,​$90:​POKE $02F4,​$B4
1 O=ADR("@"):​F=$04:​DIM A(F,​F):​POKE 752,​%1:​DL=$B000:​DPOKE DL,​$7070:​J=DL+%2:​FOR I=%1 TO 13:​POKE J,​$47:​J=J+%1:​DPOKE J,​W:​J=J+%2:​W=W+40:​NEXT I:​POKE J,​$41:​J=J+%1:​DPOKE J,​DL:​J=J+%2:​?:​? ":​;;;<//2/?=...>":​? ":​;;;<//4/?=...>":​? ":​;;;<//8/?=...>"
2 ? ":​;;;</16/?=...>":​? ":​;;;<//32?=...>":​? ":​;;;</64/?=...>":​? ":​;;;</128?=...>":​? ":​;;;</256?=...>":​? ":​;;;</512?=...>":​? ":​;;;<1024?=...>":​? ":​;;;<2047?=...>":​T=J:​FOR Y=%0 TO $0B:​FOR M=%0 TO $0E:​A=PEEK(V+Y*$28+M):​POKE J,​A!PEEK(O+Y MOD F):​J=J+%1
4 # S:​CLS:​FOR X=%1 TO F:​FOR Y=%1 TO F:​A(X,​Y)=%0:​NEXT Y:​NEXT X
5 # R:​POKE $02FC,​$FF:​E=%1:​FOR X=%1 TO F:​FOR Y=%1 TO F:​IF NOT A(X,​Y):​E=%0:​EXIT:​ENDIF:​NEXT Y:​NEXT X:​IF E:​POSITION 5,​5:​A=PEEK(V):​? "GaMe OvEr";:​POKE V,​A:​GET X:​GO# S:​ENDIF:​X=RAND(F)+%1:​Y=RAND(F)+%1:​IF A(X,​Y)=%0:​A(X,​Y)=1:​ELSE:​GO# R:​ENDIF
6 FOR Y=%0 TO %3:​FOR X=%0 TO %3:​A=A(X+%1,​Y+%1):​FOR M=%0 TO %2:​MOVE T+$05*(A+A+A+M),​V+$05*($08*(Y+Y+Y+M)+X),​$05:​NEXT M:​NEXT X:​NEXT Y
7 DO:​K=PEEK($02FC)&$3F:​IF K=$0E:​G=%2:​H=-%1:​K=H:​L=F:​M=%1:​GO# UP:​ENDIF:​IF K=$0F:​G=%3:​L=%1:​M=-%1:​H=%1:​K=%1:​GO# UP:​ENDIF:​IF K=$06:​G=%2:​H=F:​K=%1:​L=-%1:​M=-%1:​GO# LEFT:​ENDIF:​IF K=$07:​G=%3:​H=%1:​K=-%1:​L=%1:​M=%1:​GO# LEFT:​ENDIF:​LOOP
8 # UP:​FOR X=%1 TO F:​FOR I=G TO L STEP M:​FOR Y=I TO G STEP H:​IF A(X,​Y+K)=%0:​A(X,​Y+K)=A(X,​Y):​A(X,​Y)=%0:​ELSE:​IF A(X,​Y+K)=A(X,​Y):​A(X,​Y+K)=A(X,​Y+K)+%1:​A(X,​Y)=%0:​ENDIF:​ENDIF:​NEXT Y:​NEXT I:​NEXT X:​GO# R
9 # LEFT:​FOR Y=1 TO F:​FOR I=G TO H STEP K:​FOR X=I TO G STEP L:​IF A(X+M,​Y)=%0:​A(X+M,​Y)=A(X,​Y):​A(X,​Y)=%0:​ELSE:​IF A(X+M,​Y)=A(X,​Y):​A(X+M,​Y)=A(X+M,​Y)+%1:​A(X,​Y)=%0:​ENDIF:​ENDIF:​NEXT X:​NEXT I:​NEXT Y:​GO# R	

This is non-commercial site, its content is based on Atari 8-bit home computer contents and references.
If you feel your rights are violated by showing/using any part of contents of your product represented on this page, please contact me immediatelly so I can remove it!