:.THE2048 By Baptystes :ClrDrawClrHome : :"<fonct>v</fonct>THE2048"→Str1 :!If GetCalc(Str1)→Θ :GetCalc(Str1,2)→Θ :Return!If Θ :0→{Θ}r :End : : :DiagnosticOff :1→Q :While Q and (getKey≠15) :0→C→D :For(A,0,15 :0→{L1+A} :End : :0→Q :ClrHomeClrDraw : :If (sub(RND,0)=2) :sub(RND,1) :Else :sub(RND,0) :End :. :0→S :sub(NUM :StoreGDB :sub(GRI :DispGraph :0→Q :Repeat (getKey(15)) or Q :Repeat (((getKey→K>0) and (K<5)) or getKey(15)) :End :If (K>0) and (K<5) :If sub(MOV,K :.Pause 2000 :ClrHomeClrDraw :(sub(RND,0)=0)→Q :sub(NUM :StoreGDB :sub(GRI :DispGraph :End:End :1→Q :For(K,1,4 :If (sub(TST,K :0→Q :End:End : :End : :If Q :Text(27,26,"Game Over !" :Pause 500 :Text(15,32,"[annul] ou [entrer]" :0→Q :Repeat ((getKey→K=9) or (K=15)) :End :0→Q :If (K=9) :1→Q :End :End :If (S>{Θ}r) :S→{Θ}r :End :.Q: :End :ClrDrawClrHome :If (getKey(15) and getKey(54) and getKey(9)) :DelVar "<fonct>v</fonct>THE2048" :End : :Return : : :Lbl MOV :0→L :For(A,0,3 :4→Y :For(B,0,3 :.V:DIRECTION :.W:PERPENDIC :If (r1=3) or (r1=2) :B→V :A→W :Else :A→V :B→W :End :If (r1=3) or (r1=1) :3-V→V :3-W→W :End :If ({W*4+V+L1}→M≠0) :0→X :0→C :Repeat C :0→H :If (((V>0) and (r1=2)) or ((V<3) and (r1=3)) or ((W>0) and (r1=4)) or ((W<3) and (r1=1))) :0→X→U :{W*4+V+L1}→M :If ({W+(r1=1)-(r1=4)*4+V+(r1=3)-(r1=2)→N+L1}=0) :L++ :0→{W*4+V+L1} :M→{N+L1} :ElseIf ({N+L1}=M) :1→C :If (((V>Y) and (r1=2)) or ((V<Y) and (r1=3)) or ((W>Y) and (r1=4)) or ((W<Y) and (r1=1)) or (Y=4)) :If ((r1=3) or (r1=2)) :V→Y :Else:W→Y :End :0→{W*4+V+L1} :M+1→M→{N+L1} :L++ :.Disp "B" :M→H :.ACTIVED?: :End : :.TEST U=1,2?: :Else :1→C :End : :If H :1→M :For(R,1,H :M*2→M :End :M+S→S :End :Else :1→C :End :V-(r1=2)+(r1=3)→V :W-(r1=4)+(r1=1)→W : :.REPEAT :End :.M≠0: :End :End:End :ReturnL : : :Lbl TST :0→L :For(A,0,3 :4→Y :For(B,0,3 :If (r1=3) or (r1=2) :B→V :A→W :Else :A→V :B→W :End :If (r1=3) or (r1=1) :3-V→V :3-W→W :End :If ({W*4+V+L1}→M≠0) :0→C :Repeat C :0→H :If (((V>0) and (r1=2)) or ((V<3) and (r1=3)) or ((W>0) and (r1=4)) or ((W<3) and (r1=1))) :0→U :{W*4+V+L1}→M :If (({W+(r1=1)-(r1=4)*4+V+(r1=3)-(r1=2)→N+L1}=0) or ({N+L1}=M)) :1→C :L++ :.ACTIVED?: :End :.TEST U=1,2?: :Else :1→C :End : :V-(r1=2)+(r1=3)→V :W-(r1=4)+(r1=1)→W : :End : :.M≠0: :End :End:End :ReturnL : : :Lbl RND :1→C :For(A,0,3 :For(B,0,3 :!If {A*4+B+L1} :0→C :End :End:End :!If C :While (getKey≠15) :rand^4→A :rand^4→B :End!If ({A*4+B+L1}) :!If r1 :rand^2+1→Z→{A*4+B+L1} :Else :r1→Z→{A*4+B+L1} :End :Text(B*13+26,A*13+15,"." :Else :0→Z :End :ReturnZ : : :Lbl NUM :.0→S :For(A,0,3 :For(B,0,3 :{B*4+A+L1}→E :1→N :If E :If E≤9 :For(C,1,E :N*2→N :End :N→E :Else :Text(A*13+21,B*13+5,"." :Text(A*13+32,B*13+5,"." :Text(A*13+21,B*13+16,"." :Text(A*13+32,B*13+16,"." :End :Text(A*13+25-(2*(E>10))-(2*(E>100)),B*13+12,E►Dec : :End:End:End :Text(0,0,"BAPTYSTES" :Text(42,0,S►Dec :Text(65,0,{Θ}r►Dec :Text(0,58,"0.9" :Return : : :Lbl GRI :For(A,0,4 :Line(A*13+20,9,A*13+20,61 :Line(20,A*13+9,72,A*13+9 :End :Return