Marble Solitaire Solution Display in GDI+


The application finds and displays solutions to a game of solitaire. The application was written using Visual Studio.NET Version 7.0.9254. The test suite was written using NUnit, which is a .NET port of JUnit. 


To compile and run the application, just open the visual studio project and press F5. A test suite was also written using NUnit. The test batch file relies on NUnit been installed at "C:\Program Files\NUnit\bin\NUnitGui.exe". This test suite is available from 

For further details see 

Source Code 

  • Solution.cs.          Recursively finds the solution, given a start position
  • Move.cs              Simple wrapper class used to represent and parse a move.
  • Mover.cs             Determines the valid moves, given a board state.
  • Board.cs             Represents the solitaire board.
  • Form1.cs             GUI which displays the controls and solution graphically.
  • Log.cs                Log file creation utility
  • AllTest.cs            ITest, all the tests defined
  • BoardTest.cs       Tests for the board functionality
  • LogTest.cs          Tests logging functionality
  • SolutionTest.cs    Tests the solution finder.

The images used are contained in a resource file MyResources.resources 

There is a bug in the program where if you reset several time and hit solve, the program sometimes crashes. I think this is due to a bug in Hashtable, if anyone knows how to fix it, send it on ;-)

Similar Articles