Kolik trilobitu ma jeden trilobyte?

2187



The 2187 game a bit harder, than the famous 2048. When three identical numbers appears in the row, two of them disappers and the middle one is tripled.
Example:
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |        |        |        |    1   |
|        |        |        |        |        |        |
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |        |        |        |        |
|        |        |        |        |        |        |
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |        |        |        |    1   |
|        |        |        |        |        |        |
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |        |        |        |    1   |
|        |        |        |        |        |        |
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |    1   |        |        |    3   |
|        |        |        |        |        |        |
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |        |    3   |    9   |    9   |
|        |        |        |        |        |        |
-------------------------------------------------------

Let's press the key 's' to move all numbers down.
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |        |        |        |        |
|        |        |        |        |        |        |
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |        |        |        |        |
|        |        |        |        |        |        |
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |        |    3   |        |    3   |
|        |        |        |        |        |        |
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |        |        |        |        |
|        |        |        |        |        |        |
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |        |        |        |    3   |
|        |        |        |        |        |        |
-------------------------------------------------------
|        |        |        |        |        |        |
|        |        |    1   |    3   |    9   |    9   |
|        |        |        |        |        |        |
-------------------------------------------------------

Numbers "falled down" and three "1"s on the right side has been converted to one "3" with two free spaces around. Another "3" appeared nead the middle of playground.
Use WASD keys to let numbers "fall" to prefered side and E key to just convert all triplets to three-times higher numbers without move.
Download game written in bash: game2187
It needs linux with bash, bc, any text terminal (xterm will do the job) and working WASDE keys on your keyboard.

Download game written in python (smaller, faster, ignores unused keys): 2187.py
Needs python (tested on linux with python 2.7.3), text terminal and WASDE keys.

Don't forget to set executable flag. For shell version it's:
chmod +x game2187
./game2187

For help press key 'h'.