Prog 6: Tic-tac Undo
Program 6:
Add to a solution from program 5 so that every move (board pieces, pieces to move and move number) are stored on a linked list node. User input of 'u' (or 'U') for undo should allow repeating the previously numbered move. Attempting to undo at the beginning of the game should give an error message and allow retrying the move.
You may use my Program 5 solution or the solution of some other student as the starting point for this program, and should document this fact if you do so. Grading for the most part will be all-or-nothing on this assignment.
An ASCII graphics version of part of a game could look like the following:
Program #6: Tic Tac Two with Undo
Author: Dale Reed
Lab: Tues 8am
System: Mac OS X, xCode IDE
-------------------
| . . . . . | Pieces remaining for:
| | Player 1: A B C D
| . . | . | . . | Player 2: a b c d
| --------- |
| . . | . | . . | Grid destination squares:
| --------- | 1 2 3
| . . | . | . . | 4 5 6
| | 7 8 9
| . . . . . |
-------------------
1. Player 1: Enter piece to move and destination number: A2
-------------------
| . . . . . | Pieces remaining for:
| | Player 1: B C D
| . . | A | . . | Player 2: a b c d
| --------- |
| . . | . | . . | Grid destination squares:
| --------- | 1 2 3
| . . | . | . . | 4 5 6
| | 7 8 9
| . . . . . |
-------------------
2. Player 2: Enter piece to move and destination number: c 6
-------------------
| . . . . . | Pieces remaining for:
| | Player 1: B C D
| . . | A | . . | Player 2: a b d
| --------- |
| . . | . | c . | Grid destination squares:
| --------- | 1 2 3
| . . | . | . . | 4 5 6
| | 7 8 9
| . . . . . |
-------------------
3. Player 1: Enter piece to move and destination number: u
-------------------
| . . . . . | Pieces remaining for:
| | Player 1: B C D
| . . | A | . . | Player 2: a b c d
| --------- |
| . . | . | . . | Grid destination squares:
| --------- | 1 2 3
| . . | . | . . | 4 5 6
| | 7 8 9
| . . . . . |
-------------------
2. Player 2: Enter piece to move and destination number: c 5
-------------------
| . . . . . | Pieces remaining for:
| | Player 1: B C D
| . . | A | . . | Player 2: a b d
| --------- |
| . . | c | . . | Grid destination squares:
| --------- | 1 2 3
| . . | . | . . | 4 5 6
| | 7 8 9
| . . . . . |
-------------------
3. Player 1: Enter piece to move and destination number: u
-------------------
| . . . . . | Pieces remaining for:
| | Player 1: B C D
| . . | A | . . | Player 2: a b c d
| --------- |
| . . | . | . . | Grid destination squares:
| --------- | 1 2 3
| . . | . | . . | 4 5 6
| | 7 8 9
| . . . . . |
-------------------
2. Player 2: Enter piece to move and destination number: u
-------------------
| . . . . . | Pieces remaining for:
| | Player 1: A B C D
| . . | . | . . | Player 2: a b c d
| --------- |
| . . | . | . . | Grid destination squares:
| --------- | 1 2 3
| . . | . | . . | 4 5 6
| | 7 8 9
| . . . . . |
-------------------
1. Player 1: Enter piece to move and destination number: u
*** Cannot undo at the beginning of the game. Please retry.
1. Player 1: Enter piece to move and destination number: D1
-------------------
| . . . . . | Pieces remaining for:
| | Player 1: A B C
| . D | . | . . | Player 2: a b c d
| --------- |
| . . | . | . . | Grid destination squares:
| --------- | 1 2 3
| . . | . | . . | 4 5 6
| | 7 8 9
| . . . . . |
-------------------
2. Player 2: Enter piece to move and destination number:
Turning it In
Only individual work is allowed for both program 6. (Pair programming was allowed only for programs 3 & 4.)
As in previous assignments, create an executable named netid.cpp, and zip this up into netid.zip. Turn this in to the programming assignment called Prog 6.
Extra Credit
Extra Credit (10 points): Implement playing against a smart computer opponent that exhibits a reasonable level of playing skill.
Submit this into Blackboard project Program 6 Extra.