Prog 2: Peg Jump

1/30 Clarifications made are shown in blue.

1/31 Turn-in naming conventions are similar to that of program 1, and are shown at the bottom in red.

Write a program to play a peg jumping game (examples can be played online here and here). Running the program looks like what is shown below, where the boldfaced text is something that you type in.

Author: Dale Reed Assignment: 2, PegJump TA: Karla Templar, Tues 10 Jan 25, 2017  This program represents the peg jumping puzzle.  The board starts out with a single blank position, represented by the 'O'.  To make a move, select the letter of the peg to be moved, then the letter of the destination position. (e.g. the first move might be: d a, meaning we move peg ‘d’ into blank position ‘a’.) A peg must be able to jump over an adjacent peg into a blank for a  move to be valid.  The jumped peg is then removed from the board.   The game is over when there are no valid moves left to be made, or when there is a single peg left.  At any point enter 'x' to exit the program. -----------------------   Board    Positions     o          A                  + +        B C               + + +      D E F           + + + +    G H I J       + + + + +  K L M N O    1. Enter your move: D a   -----------------------   Board    Positions     +          A                  o +        B C               o + +      D E F           + + + +    G H I J       + + + + +  K L M N O    2. Enter your move: K D   -----------------------   Board    Positions     +          A                  o +        B C               + + +      D E F           o + + +    G H I J       o + + + +  K L M N O    3. Enter your move: i g   -----------------------   Board    Positions     +          A                  o +        B C               + + +      D E F           + o o +    G H I J       o + + + +  K L M N O    4. Enter your move: n p    *** Invalid destination.  Please retry **** 4. Enter your move: q n    *** Invalid source.  Please retry **** 4. Enter your move: j h    *** Must jump a piece.  Please retry. *** 4. Enter your move: b i    *** Source must have a piece.  Please retry. *** 4. Enter your move: l n    *** Destination must be empty.  Please retry. *** 4. Enter your move: g b  -----------------------   Board    Positions     +          A                  + +        B C               o + +      D E F           o o o +    G H I J       o + + + +  K L M N O    5. Enter your move: a d   -----------------------   Board    Positions     o          A                  o +        B C               + + +      D E F           o o o +    G H I J       o + + + +  K L M N O    6. Enter your move: c h   -----------------------   Board    Positions     o          A                  o o        B C               + o +      D E F           o + o +    G H I J       o + + + +  K L M N O    7. Enter your move: l e   -----------------------   Board    Positions     o          A                  o o        B C               + + +      D E F           o o o +    G H I J       o o + + +  K L M N O    8. Enter your move: j c   -----------------------   Board    Positions     o          A                  o +        B C               + + o      D E F           o o o o    G H I J       o o + + +  K L M N O    9. Enter your move: c h   -----------------------   Board    Positions     o          A                  o o        B C               + o o      D E F           o + o o    G H I J       o o + + +  K L M N O    10. Enter your move: n l   -----------------------   Board    Positions     o          A                  o o        B C               + o o      D E F           o + o o    G H I J       o + o o +  K L M N O    11. Enter your move: d m   -----------------------   Board    Positions     o          A                  o o        B C               o o o      D E F           o o o o    G H I J       o + + o +  K L M N O    12. Enter your move: l n   -----------------------   Board    Positions     o          A                  o o        B C               o o o      D E F           o o o o    G H I J       o o o + +  K L M N O    13. Enter your move: o m   -----------------------   Board    Positions     o          A                  o o        B C               o o o      D E F           o o o o    G H I J       o o + o o  K L M N O     # left  Rating ------  ---------------   >4    Dufus   4     Poor   3     Mediocre   2     Good Job   1     Awesome Genius!  You had 1 left.  Awesome Genius!  Thanks for playing.  Exiting...

You need to know the following concepts in order to write this program:

Variables, assignment statements, loops, if statements, functions, parameters

Notes:

You may not use arrays for this program.  You may use functions, along with reference parameters (a.k.a. pointer parameters in Zyante).