I am having a hard time identifying how to approach this problem.
If you have a match 3 game and the objects can only be swapped horizontally and vertically, and only swapped if it will result in a match of 3 or more jewels, which will be removed, with each removed jewel adding +1 to the score.
How would I find the best possible move? I'm confused at where to start and been searching for a while now and getting nowhere.
- Board 6x6 or 8x8
- Matches = 3 or more of same kind
- write function to find best swap for maximum score.
Any help would be greatly appreciated !
EDIT: So I could iterate through the entire board with a nested for loop for the rows and columns, but im not sure what approach to take from here.
For example, say I start with top left which is "red" and I want to test if swapping this will result in a match. How would I go about searching and identifying all possibilities that would result in swapping this left equaling a match and score of 5.
**If I am being really unclear I apologies and will remove my question and possible reword.