Mahjong solitaire

Select two identical tiles to remove them. Once all tiles are removed, the game is won.

Only open tiles can be selected, meaning that they are on top and at least on one of their sides (left, right) there is no tile.

It may happen that you make a wrong move after which the game cannot be won anymore.

Check out Wikipedia for a description of all the 144 tiles. They fall into 7 categories (dots, bamboos, characters, winds, dragons, seasons, flowers). Every tile appears exactly 4 times, except for the 4 seasons

and the 4 flowers

which each appear only once. For this reason every pair of seasons (or flowers) can be removed as well, even if they are not identical.

You can find the code of this game on GitHub.