- Tech Corner
- Tools + Games
- Tetris
Tetris
Overview
This is a rewrite in Java of the game tetris, a puzzle game invented by a Russian programmer Alexey Pajitnov. A complete overview of the game can be found on Wikipedia. This implementation runs with Java 1.2 and later.
Keys binding
- Left - move left
- Right - move right
- Down - move down
- Space - move all the way down
- Up or F - rotate clockwise (right)
- S - rotate counterclockwise (left)
- P - pause/resume the game
- F8 - decrease level, works only before game start
- F9 - increase level
- F2 - start game
Scoring
The scoring formula is explained in details on Wikipedia's tetris page. I use that formula in this implementation. In short, the more simultaneous lines are removed, the more points are scored. However, if you leave the preview on, you will only get half as much points.
In normal gravity mode, bonus points are rewarded for any additional full lines removed as a result of hanging blocks falling down. In addition to the normal points granted for those additional full lines, a bonus of (lines x 1000) is added to the total score, where lines is the number of lines removed.
Levels and speed
At level zero, tetrominoes are dropped one square per second. The drop interval is reduced by 15% at each superior level. So that at level one, tetrominoes are dropped one square per 0.85 second, and one per 0.72 second at level 2, so on and so forth. There is no limit for the levels. However the drop interval will never go below 60ms, which is reached at level 17.
Gravity
The original tetris had a hanging gravity model, that is, after full lines are removed, a free block would hang above empty spaces underneath it. In this implementation of tetris, a normal gravity model is offered as well, in which hanging blocks would fall and cause further full lines to be removed. Uncheck "Hanging gravity" to activate the normal gravity model.
Copyright © 2006, Northwest Summit. All rights reserved.