Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Writing a C++ program on a Macbook pro I am using Xcode 7.2 to try and do this.

ID: 3664388 • Letter: W

Question

Writing a C++ program on a Macbook pro I am using Xcode 7.2 to try and do this. The code needs to be simple like level 1 stuff, you just run it and the program plays by it self. No user inputs. It has two players, Jack and Jill, the players have to be called Jack and Jill and a board with 20 squares. Each player (called Jack and Jill) take turns by rolling a 6-sided die and move forward the number of squares shown. If a player lands on the same square as his or her opponent, the opponent tumbles back a random number of 1 – 3 squares. The first player to reach the "top" of the hill (square 20) wins.

Use random numbers to simulate rolls of the die. Use the variables jack and jill to store player positions. Use the pseudocode below to structure your program. Mimic the sample output as closely as possible.

Use tabs ( ) to line up the output columns.

To generate a random number for a 6-sided die:

First, initialize random number generator: srand(time(NULL));

Declare an integer variable called roll

Roll a 6-sided die: roll = rand() % 6 + 1

Pseudocode

// Add any other needed includes

#include //for seeding the random number generator

Initialize random number generator

Set finished to false

Do {

   // Jack’s turn.

Roll die for Jack and add to Jack’s position

If Jack’s position is the same as Jill’s position

   Move Jill back a random 1-3 squares

   Print result of Jack’s turn plus Jill’s tumble

Otherwise, print result of Jack’s turn

If Jack reached the top of the hill

Set finished to true

Set winner to “Jack”

// Jill’s turn.

Skip if Jack already won

     Otherwise same logic as Jack’s turn

} while not finished

Print winner

Sample Output

Roll Jack Jill

-------------------------------              

5    5        

5    2    5    Tumble Jack!

6    8        

2         7   

4    12       

5    10   12   Tumble Jack!

2    12   11   Tumble Jill!

5         16  

1    13       

5         21            

Jill wins!

Explanation / Answer

#include #include #include #include #include #include void call(); void one(); void two(); void three(); void four(); void five(); void six(); void call(); int main() { //gotoxy(30,15); cout