MineSweeper Code Review

This AI was a challenging one to write. My personal skill and understanding of the game was lacking at the start so a lot of time went into researching the rules and trying to play a game i could never beat in the past. Once I gained a better understanding of the rules I decided to make it as simple as possible. I chose to act like my AI was a normal player, but missing the flags. Due to this there isn’t anything holding all of the found mines, mostly considering a player is rarely positive.

It is a simple set of ifs checking that it is mostly safe than click it otherwise move on, also make sure the nearby cells may be safe. If a nearby cell is safe it will return that index to click there in order to save time and move the game forward. The code is not perfect and the win percentage is low, but keeping it basic allows for people similar to me who have trouble understanding the game to follow the base idea and improve upon it. Adding to this and fixing it will be a nice side project and hopefully I can find a technique better than If and else if to decide where to click.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s