Lab 14

For this week's lab we will be playing a game using link list. We will be implementing a coin swap game using the knowledge we gained over weeks

The code we've given you, will give you an idea how to play the game. It has got a Node struct, and a function which prints out the board.

The example of the game is:

 

 

initial board: 1     2    3    4    5

                    H    H    .    T    T

 

Step 1:       1    2    3      4    5

                   H    .    H    T    T

 

Step 2 :      1     2     3     4     5

                   H    T    H      .    T

 

Step 3:        1    2    3    4    5

                    H    T    .    H    T

 

 ....

.....

.....

 

Final Step: 1     2      3      4      5

                   T    T    .       H       H

 

 

To undo the move we have to go from Step 2 to Step 1

Notes:

Submission:

1. You should work with a partner for this (and all the remaining) lab(s). Only one of you need to submit the program to Blackboard, though you should be certain that both of your names be present in a comment at the top of the .c or .cpp source file.

1.5 If you work alone, include just your name in a comment at the top so that I know you worked alone, and not have to guess.

2. You should turn in to Blackboard by the END OF THE LAB. I know it's tempting to keep working on it, but other classes come in, and it's not fair to the students who are limited to that particular time span if you go over. Which isn't to say that you can't work on it later, to check your solution against the one I post for your own understanding. But what you submit for a grade should be before the next hour begins.

3. If you wish, you may submit your lab by noon on Friday for a 1 point penalty. If you can't finish up the second point by the end of lab, you can still earn the score by completing all three steps and submitting your code by the day after.