Prog 6 Mancala List

Modify your solution to the previous Mancala program (or mine if you didn't get it finished) to have the following additional features:

Samples of the above steps are given below.  Also included as attachments to this page are executable versions of the program, for PC (585K, reset extension to .exe) and for Mac (20K OS X  10.8.2 on Intel processor).

Undoing moves using a linked list

Author: Dale Reed  Program 5: Mancala TA: Susan Rice, Wed 7am Nov 27, 2012  Welcome to the game of Mancala, where you are playing against  a computer opponent.  You may enter 'u' to undo a move or  'x' to exit. Your holes are on the bottom row and you get  to go first.              A    B    C    D    E    F                   -----------------------------            ----|  3 |  3 |  3 |  3 |  3 |  3 |----      |    |                             |    |      ----|  3 |  3 |  3 |  3 |  3 |  3 |----            -----------------------------                   A    B    C    D    E    F         -------------------------------------------  1. Select a move (A..F)-> e             A    B    C    D    E    F                   -----------------------------            ----|  3 |  3 |  3 |  3 |  3 |  4 |----      |    |                             |  1 |      ----|  3 |  3 |  3 |  3 |    |  4 |----            -----------------------------                   A    B    C    D    E    F            ----------------------------------------     Computer chooses C             A    B    C    D    E    F                   -----------------------------            ----|  4 |  4 |    |  3 |  3 |  4 |----      |  1 |                             |  1 |      ----|  3 |  3 |  3 |  3 |    |  4 |----            -----------------------------                   A    B    C    D    E    F            Computer gets another move     Computer chooses A              A    B    C    D    E    F                   -----------------------------            ----|    |  4 |    |  3 |  3 |  4 |----      |  2 |                             |  1 |      ----|  4 |  4 |  4 |  3 |    |  4 |----            -----------------------------                   A    B    C    D    E    F         -------------------------------------------  2. Select a move (A..F)-> u Undo was selected.  Restoring game back to previous move.             A    B    C    D    E    F                   -----------------------------            ----|  3 |  3 |  3 |  3 |  3 |  3 |----      |    |                             |    |      ----|  3 |  3 |  3 |  3 |  3 |  3 |----            -----------------------------                   A    B    C    D    E    F         -------------------------------------------  1. Select a move (A..F)-> u Undo was selected.  Restoring game back to previous move. Sorry, you cannot undo past the beginning of the game.  Please retry move.            A    B    C    D    E    F                   -----------------------------            ----|  3 |  3 |  3 |  3 |  3 |  3 |----      |    |                             |    |      ----|  3 |  3 |  3 |  3 |  3 |  3 |----            -----------------------------                   A    B    C    D    E    F         -------------------------------------------  1. Select a move (A..F)-> 

User input handling

Author: Dale Reed  Program 5: Mancala TA: Susan Rice, Wed 7am Nov 27, 2012  Welcome to the game of Mancala, where you are playing against  a computer opponent.  You may enter 'u' to undo a move or  'x' to exit. Your holes are on the bottom row and you get  to go first.              A    B    C    D    E    F                   -----------------------------            ----|  3 |  3 |  3 |  3 |  3 |  3 |----      |    |                             |    |      ----|  3 |  3 |  3 |  3 |  3 |  3 |----            -----------------------------                   A    B    C    D    E    F         -------------------------------------------  1. Select a move (A..F)-> g Invalid input.  Please retry. 1. Select a move (A..F)-> 2 Invalid input.  Please retry. 1. Select a move (A..F)-> x Exiting program before end of game...

Command Line parameters

Dales-iMac:Mancala reed$ ./Mancala -b 00000102222220 Author: Dale Reed  Program 5: Mancala TA: Susan Rice, Wed 7am Nov 27, 2012  Welcome to the game of Mancala, where you are playing against  a computer opponent.  You may enter 'u' to undo a move or  'x' to exit. Your holes are on the bottom row and you get  to go first.              A    B    C    D    E    F                   -----------------------------            ----|  2 |  2 |  2 |  2 |  2 |  2 |----      |    |                             |    |      ----|    |    |    |    |    |  1 |----            -----------------------------                   A    B    C    D    E    F         -------------------------------------------  1. Select a move (A..F)-> f             A    B    C    D    E    F                   -----------------------------            ----|  2 |  2 |  2 |  2 |  2 |  2 |----      |    |                             |  1 |      ----|    |    |    |    |    |    |----            -----------------------------                   A    B    C    D    E    F         Game is over.  Remaining pieces are being placed into the store.             A    B    C    D    E    F                   -----------------------------            ----|    |    |    |    |    |    |----      | 12 |                             |  1 |      ----|    |    |    |    |    |    |----            -----------------------------                   A    B    C    D    E    F         Computer wins! Thanks for playing!  Goodbye... Dales-iMac:Mancala reed$