Minesweeper Programming Contest. Using Selenium Web Driver to win Minesweeper

I had a great time attending the Test Automation Bazaar  in Austin. Alister Scott put on a contest to see who could write a program to win Minesweeper.  After checking out what was required, I started coding the Minesweeper robot. Before I noticed, I had spent hours coding tests and methods for the robot.  It was one of the most addictive and exciting code I had written.  I spent about 3 days coding along to get something to win on basic and intermediate level. I spent hours trying to win on advanced.

I ended up winning the Minesweeper Challenge!  I encourage everyone to take a look at Alister’s code.  Alister wrote some of the  best cukes and examples I have seen.  I was very impressed by the time he put into writing unit tests that work on logic only, taking the browser out of the mix.  Thanks Alister for putting on the contest.  If you wish to see what 3 days of coding gets you in a mine sweeper robot you can checkout my code on github.  As I mentioned before I got really engaged with writing this code.  I could have spent weeks tuning and polishing it.  I did have a chance to refractor the code to use Nokogiri instead of the find all elements selenium method to check the game state.  I believe that this might have actually slowed it down.

Sadly to say, I had to withdraw from polishing and tuning the code.  If you want to run my robot checkout the code and run the test “Minesweeper should win” in this file.


Comments are closed.