DSA555 – Peg jump / solitaire solver

Assignment 1 in DSA555 at Seneca College in Data Structures and Algorithms in C++

Peg solitaire is a game where a set amount of pegs are filled in on a board with a set amount of pegs slots. To solve the Solitaire, a player consecutively jumps a peg over another peg , which in turn is emptied out. This process is repeated until there is only one peg on the board.

A C++ program that takes a file name as input . It expects the first line to be in this format:
where height and width are valid integers. Using these numbers, it processes the rest of the file using this format:
Character ‘O’ is an empty peg.
Character ‘X’ is a taken peg.

Once the board is parsed , if the board has a solution thus has only one peg left , it will print out the consecutive steps to solve it or it will print “No solution” if a solution can’t be found .


Using command prompt: <executable> <test board>

Boards can be downloaded below the source code download link, or a new board can be created as long as it follows above format.

Zip archive is located here: http://zenebo.com/solitaire.zip

Test boards can be downloaded here : http://zenebo.com/solitaire_test_boards.zip

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s