I'm trying to make a match 3 game in C++ and I want to make a best move method to show the player the ideal position to move to get the most amount of points.
The rules of the game are as follows:
- Pairs of objects adjacent vertically and horizontally can be swapped.
- You can only swap objects when this will result in a match being created.
- A match happens when there are 3 or more objects of the same kind adjacent vertically or horizontally.
- objects that match are removed from the board. objects above a gap will keep fall down until all gaps are filled. New matches made by objects falling into place will be removed with the process repeating until there are no matches left.
- Points are awarded based on the number of objects removed. The best move for a given board is the one that removes the most objects .
However, I'm stumped for ideas on how to implement such a method. Can anyone give me some ideas on how I can do it?
If you've made a match 3 game, and have implemented a similar method; how did you do it?