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?

  • \$\begingroup\$ Brood force would be try all possible moves and pick the best. \$\endgroup\$ Jun 2, 2013 at 14:54
  • 3
    \$\begingroup\$ The answer strongly depends on whether you want to get the most points in one move, or if you also want to set up the board for a more profitable next move (like an experienced human player does). In the latter case the player may not immediately see why the move was so good. \$\endgroup\$
    – Dan Hulme
    Jun 2, 2013 at 14:58
  • 2
    \$\begingroup\$ There seem to be some ideas in gamedev.stackexchange.com/questions/2607/… \$\endgroup\$
    – Dan Hulme
    Jun 2, 2013 at 14:59


Browse other questions tagged .