This program will simulate the game of pegs, and take into account all possible combinations of moves to answer a series of questions about the game. Usage is simply "pegs", and there are no command lines or even input as the simulation only has one purpose. For those of you who are unfamiliar with the game, here is a quick runthrough.
The game is very simple. Fifteen pegs, numbered 1 through 15, are placed into five rows in such a manner that row 1 has 1 peg, row 2 has 2 pegs, etc. The peg in position number 1, that is at the very top of the triangle that has been formed, is removed. Then play begins by jumping a peg over another peg into an empty spot. The peg that has been jumped over is then removed, and play continues until there are no more possible jumps. The goal is to leave exactly one peg on the board.
You may have certain questions about the game, such as:
1. How many pegs can remain on a board at the end of a game?
2. How many combinations of moves are there for the first n moves?
3. If one peg remains, where will it be?
If you do, you've certainly come to the right place, because this documentation and this program will tell you everything you need to know about the game.
The end result of this program, which will take several minutes to run, is output to the screen with important game data. Here is an example of the output you might get.
Using this output, one can draw several conclusions. If interested, here are the conclusions I came up with.