I'm developing an Okey game (a Turkish version of Rummikub/Rummy). In it, each players has a bunch of tiles. Tiles have a colour and a number, like playing cards. Now, the player needs to make sets of these tiles, with three options:
- Groups: Same number, different colours (Red 1, Blue 1, Black 1)
- Straights: Same colour, sequence of numbers (Red 1, Red 2, Red 3)
- Doubles: Two identical tiles
I'm now trying to create a simple AI for the game. I want it to be able to find and create sets in/from its own tiles.
I already have a TileSet class. Feed it a list of tiles and it will say whether it's a valid set and of what type.
Using this, what kind of algorithm can I use to find the sets in an unordered heap of tiles?