Match Game Pseudo Code

The following is a pseudo code solution for one way to approach the Microsoft Match Game.

It provides a possible approach that you could use to create a game play 'bot' that could match every tile in the game.

Is it the best approach to playing the game, probably not. Can you come up with a better solution? Now is you chance to find out. Review our ideas here and code a solution of your own now.

  • Determine if it is the very first move of the game when we do not have any upturned tiles to analyse and we must just make our very first move
    • If it is the first move of the game, return a set of random cards as we have not yet been able to see what is on any cards
    • If we do have some upturned cards
      • Use the Microsoft API to analyse the cards
      • Search the analysis results for the relevant information about each card
        • is it a landmark, or an animal or some text
      • Remember the subject (e.g Big Ben) and the tile location (e.g. 7) for quick comparison later
      • Check to see if the subject of the card matches the subject of any previous cards we have analysed and remembered already
        • If there is a match use these two matching tiles for our move
        • If there is not a match
          • Check and make sure we haven't tried to match all tiles already (remember, the API is using AI to analyse images. It might get it wrong and there is a slim chance that some tiles might never match based on the analysis the API returns)
            • If we have already tried to match all the tiles, there must be an error in the API analysis data or our handling of it.
            • Work through the remaining tiles trying to match each in turn until you have successfully matched them all.
        • If we haven't yet tried to match all of the tiles, choose a set of random tiles to turn over for our next move
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License