The aim of this project is to write a program that can solve a game of Drench. The game can be played here, and below is a picture of what it looks like.
The aim of the game is to fill the board with a single colour. The board is a 14x14 grid filled with a random selection of coloured squares. The squares can be one of six colours; green, pink, purple, light cyan, red, and yellow.
The player starts as the top left tile and, with the six coloured buttons, they can change the colour of their tile. If the player tile changes to the colour of an adjacent tile (a tile that shares and edge with the player tile), the player object extends to encompass the original tile and the tiles of this new colour. To understand this better, have a look at the figure above. The player starts as the purple tile in the top left corner. The player then selects pink and the player object then becomes the original tile plus the two pink tiles beside it.
There are two red sections adjacent to the player object, and by changing to red, the player object now includes these two red sections.
The player then selects green, and the two green sections adjacent to the player object are now included in the player object.
The player must fill the entire grid with a single colour in fewer than 30 moves.
The two solve functions work in slightly different ways.
solve()
takes all nodes connected to player and determines which node is the
largest by number of connections. It then changes player colour to the colour
of that node and merges the two.
quickSolve()
takes all nodes connected to player and determines out of those
which colour is most common. It then changes player to that colour and all
connected nodes of that colour are merged into player.