- Tetris 3.0
- 03 Oct 2012 01:20:37 pm
- Last edited by LiquidMetal on 03 Oct 2012 01:32:05 pm; edited 1 time in total

I've been working on an implementation of Tetris for the calculator, written purely in TI-BASIC (for now). It includes a custom, hard-coded menu, a help-screen, high-scores, hard drops, and a pause menu. At least 90% of the current version (unstable) was coded on the calculator, and then I used the source-coder and TokenIDE for the remaining ~10%.

When I used the sourcecoder to unsubprogram the game, I had to make some changes to some of the files. The main one that has become a problem is the rotation script. The rotation script is supposed to check 1)That the rotation could fit within the dimensions of the matrix, 2) That the rotation will not intersect another block, and 3) do it if both were ok.

Current, broken, code excerpt:

Note: The actual dim error does not occur here, but later, when the tetronimo tries to move down one square. The problem with this is that it allows the tetronimo to rotate so that part of the piece is off the board.

Old, working (I think - not downloaded from here and tested), subprogram code

When I used the sourcecoder to unsubprogram the game, I had to make some changes to some of the files. The main one that has become a problem is the rotation script. The rotation script is supposed to check 1)That the rotation could fit within the dimensions of the matrix, 2) That the rotation will not intersect another block, and 3) do it if both were ok.

Current, broken, code excerpt:

**Code:**```
If K=25
```

{0,0,0,0,0,0,0}->|LTPD

If |LCPD(7)<7:Then

For(I,0,2)

~|LCPD(2I+1)->|LTPD(2I+2)

|LCPD(2I+2)->|LTPD(2I+1)

End

0->R

For(I,0,2)

If A+|LTPD(2I+1)>10:Then

1->R

Else

If A+|LTPD(2I+1)<1:Then

1->R

Else

If B-|LTPD(2I+2)>20:Then

1->R

Else

If B-|LTPD(2I+2)<1:Then

1->R

Else

If [A](B-|LTPD(2I+2),A+|LTPD(2I+1):Then

1->R

End:End:End:End:End

End

For(I,0,2)

Pt-Off(~1+3(A+|LCPD(2I+1)),62-3(B-|LCPD(2I+2)),2)

End

For(I,1,6)

|LTPD(I)->|LCPD(I):End

For(I,0,2)

Pt-On(~1+3(A+|LCPD(2I+1)),62-3(B-|LCPD(2I+2)),2)

End

End

End

Note: The actual dim error does not occur here, but later, when the tetronimo tries to move down one square. The problem with this is that it allows the tetronimo to rotate so that part of the piece is off the board.

Old, working (I think - not downloaded from here and tested), subprogram code

**Code:**```
:{0,0,0,0,0,0,0}→∟TPD
```

:If ∟CPD(7)<7:Then

:For(I,0,2)

:{-}∟CPD(2I+1)→∟TPD(2I+2)

:∟CPD(2I+2)→∟TPD(2I+1)

:End

:For(I,0,2)

:If A+∟TPD(2I+1)>10:Then

:Return

:End

:If A+∟TPD(2I+1)<1:Then

:Return

:End

:If B-∟TPD(2I+2)>20:Then

:Return

:End

:If B-∟TPD(2I+2)<1:Then

:Return

:End

:If [A](B-∟TPD(2I+2),A+∟TPD(2I+1):Then

:Return

:End

:End

:For(I,0,2)

:Pt-Off({-}1+3(A+∟CPD(2I+1)),62-3(B-∟CPD(2I+2)),2)

:End

:For(I,1,6)

:∟TPD(I)→∟CPD(I):End

:For(I,0,2)

:Pt-On({-}1+3(A+∟CPD(2I+1)),62-3(B-∟CPD(2I+2)),2)

:End

:End