Tetris is a 1985 two-dimensional video game where a player must fit (by applying rotation) falling pieces among previously fallen pieces.
A one-dimensional version of Tetris can be conceived simplifying the "piece" definition and leveraging colors (or characters), for example, using an addressable LED strip:
- the game field is just a single column of places, i.e. one LED is one place;
- every piece is just one single colored square, i.e. a piece is a lightened LED with a specific color;
- a falling piece is a colored square/pixel moving down the LED strip;
- a falling piece may stop at one point if it cannot "traverse" the next filled place;
- a computable rule decides if a falling piece can pass through a stacked one;
- another computable rule decides if a place can be emptied and the upper places shifted down;
- we also need a rotation function to let a player to try and adapt the falling piece to the current field situation.
Details
source code (GPL licensed), more images and some videos are available on the linked repo