TETRI

A small but intelligent version of the Tetris game for the HP49/HP49+

TETRI differs from Windows-like versions of Tetris in that the player fights with growing complexity, not with growing speed. The result depends largely on the player's skill and to a lesser extent on a lucky chance. What makes the game fascinating is the difficulty caused by the random dice distribution in the first n lines. A good player survives as a rule level 7, a very skilled player even level 9 or 10. The same game can be repeated several times with option Same, with precisely the same random dice distribution when starting in the same level. Thus, one can successively improve a first approach or compete with other players starting with the same dice distribution.

You may load a library (TETRI.lib) or a directory (TETRI.dir). Advantage of the library is that you get its menu directly from the category GAMES on the APPS key. The directory is 200 bytes smaller. If a separate High score storage is needed for your partner playing on the same calculator, load both. The library and the directory have different High Score storage places. TETRI uses the PICTURE environment. Hence, save your own grob in PICTURE  if necessary. Both versions are tested in ROM 19-6 on the HP49 and ROM 1.22 on the HP49+.
---------------------------------------------------------------------------
NEW in version 2.2003
Level choose box now independent on real number display.

NEW in version 1.2003
Turn-off suspension improved. When turning on, the 49 keeps waiting on a first
key. In the library, |Seed| toggles store/recall. |MUTE| replaced by |SND?|.

NEW in version 6.2002
The TETRI command sets the menu |NEW| |Pict| |->Seed| |Mute| |Top| |Same|.
Mute/sound-switching also with +/- during the game.

NEW in version 1.2002
A command |Same| has been added to repeat a lost game.
----------------------------------------------------------------------------
TETRI has a 1-page menu as follows:   New   Pict   Seed   Snd?   Top   Same?

New starts a new game. Pict shows last graphic after a finished game. In the TETRI library, Seed toggles recalling/storing your favourite real as a seed for the random sequence used if started with Same. In the TETRI directory, Seed is an ordinary global in which you may store any real as usual. Top always shows the highest score. Snd? toggles sound/silent mode which can be toggled also during the game but is valid only till the game is over. Clearly, Same repeats the last game only if starting in the same level. Then you get the same dice distribution and the same dropping sequence.

New or Same provide a choice of 10 start levels. To choose a level one may use a numeric key or the arrow keys. For instance, a start in Level 10 is realized by just tipping on the UParrow key. You run into the next level if the current one is successfully completed, i.e., if the number of lines displayed beneath LINES has been erased. Besides the arrow keys for moving the dropping figures and CANCEL for aborting, the following keys are active *during* a game. These are all somehow symbolized on the screen to remind on their existence.

NXT interrupts the game to get time for deciding where to locate the figure, depending on the next piece shown to the left of the play box. Pressing NXT twice turns the 49 off. The game will be resumed at the next turn-on. The +/- key toggles sound/silent mode for the current game only. Pressing the + key once or several times increases dropping speed. - decreases the dropping speed. The last speed will always be saved in memory. Thus, dropping speed is readily adapted to your convenience. Do not too hasty move a figure to the left or right in the very upper part of the box - it may jump over the margin as shown in the left-hand sceen-shot and the game is lost . A new High score is visually and acoustically announced, see the right-hand screen. It is hidden and manipulation is normally impossible.

Prevent jump over the margin
New High Score announcement may occur after surrender

Score rules for TETRI are simple. The higher the level, the higher the score after successfully completing a level. A bonus is added at the end, depending on the number c of clean lines at the moment of completion; the more lines are
clean the higher the bonus. It is maximal for c=14, i.e., all dice have been removed in the very moment of completion. Exact score calculation below. When level n is lost, the game will be over. The last bonus is either 0 or n^2.


Exact Score computation in Level n. Each dropping adds n points to the score, each erased line 2n additional points. Precisely 2n+16 lines have to be erased. When successfully completing level n, a bonus of c(n+1)^2 points is added to the score where c is defined above. Hence, a completed level n contributes at least (n+1)^2+n^2+2n(n+16)+2n(2n+16) points to the score.

Remark. There is a serious bug in ROM 1.22.  Press NXT very short, Otherwise you may ran into difficulties if trying to resume the game after a turn-off with NXT.

Credits. Thanks to Daniel Lidström who ported TETRI from the 48 to the 49.


Wolfgang Rautenberg,

raut@math.fu-berlin.de    www.math.fu-berlin.de/usr/raut