NOTE: If the download isn’t starting, try using a different browser, Chrome may not always work.
Recently I’ve learned C#/.NET and this is a project I’ve been working on to keep up some regular practice. It’s based on an assessment laid out by UW Madison’s Computer Science Department as a test to see if you are skilled enough to skip their basic programming course and move on to CS300.
If you’d like to play, download the file, unzip it, and run the executable inside, when you win or lose, just close and run the executable again to play another round.
It’s a simple peg game that you may be familiar with already. The rules, as written by UW Madison, are as follows:
“Peg solitaire is a board game (or puzzle) in which a single player takes turns removing pegs from a board until either: they have removed all but the final peg to win the game, or they have lost because there are no legal moves left for them to make despite more than one peg remaining on the board. The number of pegs and board-shapes vary, but these pegs are always set into holes arranged in a grid on the board. A legal move involves jumping one peg over a neighboring peg to rest in a hole on the other side, and then removing the peg that was jumped over. Diagonal jumps are not allowed. In the following examples, an at sign (@) is used to represent the position of pegs, and a dash (-) is used to represent the position of an empty holes. Hashtag symbols (#) represent spaces where pegs cannot be placed.”
Since I wasn’t actually getting assessed, I wasn’t super strict on the requirements of the assignment; most notably I used C# instead of Java, and I made a couple functions slightly more complex than was technically required. Either way, it meets the functional challenges asked of the original problem, and works fairly well in my opinion.