User:Ryan heise

From Hard Drop Tetris Wiki

Jump to: navigation, search

The current definition of TGM wall kicks (from the wiki)

TGM pioneered the use of wall kicks, with simple but effective kick rules. These rules were unchanged until TGM3, remaining constant across TGM, TA, TAP, and Sakura Tetris. Up to 3 locations are tried, in this order, before rotation will fail:

  • Basic rotation
  • 1 space right of basic rotation
  • 1 space left of basic rotation

In addition to these rules, there are some extra exceptions where certain wall kicks are not allowed:

  • The I tetromino will never kick.
  • L, J, and T tetrominoes will not rotate in the situations illustrated below if the X marked block is occupied.
Tet.pngTet.pngTet.pngTet.pngTet.pngTet.pngTet.pngXTet.pngTet.png
Tet.pngLLLTet.pngTet.pngLLLTet.png
Tet.pngLXTet.pngTet.pngTet.pngLTet.pngTet.pngTet.png
Tet.pngTet.pngXTet.pngTet.pngTet.pngTet.pngTet.pngTet.pngTet.png
Tet.pngTet.pngTet.pngLTet.pngTet.pngTet.pngXLTet.png
Tet.pngLLLTet.pngTet.pngLLLTet.png
Tet.pngTet.pngTet.pngTet.pngTet.pngTet.pngTet.pngXTet.pngTet.png
Tet.pngJJJTet.pngTet.pngJJJTet.png
Tet.pngTet.pngXJTet.pngTet.pngTet.pngTet.pngJTet.png
Tet.pngTet.pngXTet.pngTet.pngTet.pngTet.pngTet.pngTet.pngTet.png
Tet.pngJTet.pngTet.pngTet.pngTet.pngJXTet.pngTet.png
Tet.pngJJJTet.pngTet.pngJJJTet.png
Tet.pngTet.pngXTet.pngTet.pngTet.pngTet.pngXTet.pngTet.png
Tet.pngTet.pngITet.pngTet.pngTet.pngIIITet.png
Tet.pngIIITet.pngTet.pngTet.pngITet.pngTet.png
  • However, L tetrominoes will rotate clockwise and J tetrominoes counterclockwise in the situations illustrated below if both the X marked blocks are occupied.
Tet.pngXTet.pngTet.pngTet.pngTet.pngTet.pngTet.pngXTet.png
Tet.pngLLLTet.pngTet.pngJJJTet.png
Tet.pngLXTet.pngTet.pngTet.pngTet.pngXJTet.png

My (broken) proposal

This was my attempt to discover a simple definition than the one above. While a good guess, it was not quite right. See the next section for Zaphod77's description of TGM's true algorithm.

(My theory) A wall kick is possible with L, J, T, S and Z tetrominoes and may be triggered only by those parts of the tetromino that intersect with the following "kick mask":

Tet.pngTet.pngTet.pngTet.pngTet.pngTet.pngXTet.pngXTet.png
Tet.pngTet.pngTet.pngTet.pngTet.pngTet.pngXTet.pngXTet.png
Tet.pngTet.pngTet.pngTet.pngTet.pngTet.pngXTet.pngXTet.png

For example, if an L tetromino is rotated into the orientation shown on the left, only the squares shown on the right can be used to trigger a wall kick:

Tet.pngTet.pngTet.pngTet.pngTet.pngTet.pngXTet.pngXTet.png
Tet.pngLLLTet.pngTet.pngLTet.pngLTet.png
Tet.pngLTet.pngTet.pngTet.pngTet.pngLTet.pngXTet.png

The general procedure is as follows.

  • Perform a basic rotation
  • Apply the kick mask to determine the trigger squares
  • If any of the trigger squares have not landed on a free cell, then:
    • If there is space, move one column to the right.
    • Otherwise, if there is space, move one column to the left.

If, after this procedure, the tetromino has not succeeded in moving into free space, the entire procedure is reversed and no rotation happens.

This definition gives rise to slightly different behaviour than the original definition. For example, given the following setup:

gggggTet.pngTet.pngTet.pnggg
ggggTet.pnggLTet.pnggg
ggggLLLTet.pnggg

The original definition says that an anti-clockwise rotation will fail, but the second definition says that a right wall kick will occur:

gggggLLTet.pnggg
ggggTet.pnggLTet.pnggg
ggggTet.pngTet.pngLTet.pnggg

As confirmed by Kitaru, the right kick should occur, and so this is one case that was missing from the original definition.

Zaphod77's description of TGM's true algorithm

The "is kicking allowed" test is very simple.

It goes from upper left to lower right on the bounding box, one row at a time. it stops when it finds the first overlap.

If the first overlap is center column, rotation is prevented.

Otherwise, try kicks.