Hello again! I got pretty satsfied with mandelbrot plotting prgm, so i moved on to my next project: a 2048 clone.
For now, ive only written the underlying code. It goes as follows:
Delvar [A]
{4,4->dim([A]
randInt(1,4->A
randInt(1,4->B
2->[A](A,B
Repeat Z
Repeat not([A](A,B
randInt(1,4->A
randInt(1,4->B
End
2randInt(1,2->[A](A,B
ClrHome
For(X,1,4
For(Y,1,4
Output(2X-1,4Y-3,[A](X,Y
End
End
Repeat max(Ans={24,25,26,34
getkey->K
End
1+(K=24)+2(K=26->A
4-3(K=26->B
1-2(K=26->E
(K=24)-(K=26->G
1+(K=25)+2(K=34->C
4-3(K=34->D
1-2(K=34->F
(K=25)-(K=34->H
For(Z,1,3
For(Y,A,B,E
For(X,C,D,F
[A](X-H,Y-G
If max(Ans={[A](X,Y),0:Then // The big problem
[A](X,Y)+Ans->[A](X-H,Y-G
0->[A](X,Y
End
End
End
End
1->tetha
For(X,1,4
For(X,1,4
If not([A](X,Y:Then
5->X
5->Y
End
End
End
End
It still has some things missing, like checking if the player still has any possible move before quitting instead of quitting when finding no place to put the new tile; score; aesthetical aspects; quitting button; etc., but i guess that these dont present a problem as big as the current speed. It takes quite alot to refresh the matrix.
It would be rly helpful if you could post optimization solutions.
PS: i think this code is quite flawless as ive tested it up to a 128 record (yey! xD