Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this Project, you will write a C program to create a simple version of the Game of the Goose using 24 spaces and a

In this Project, you will write a C program to create a simple version of the Game of the Goose using 24 spaces and a two-player game mode. Player 1 will be the human player, player 2 will be the computer.

When running the program, the user will be asked to enter a positive integer number, which will be used as a seed for the generation of random numbers when rolling the dice. Then, your program prints a welcome menu displaying two options:

1) Press 'P' or 'p' to play or

2) Press 'Q' or 'q' to quit.

If the selected option is to play the game, the players should roll the dice (press enter) to determine which player should go first. The player who gets the highest value will go first in the game. Here is an example:

HUMAN PLAYER, Press to roll the dice

6 and 2 for a 8

COMPUTER PLAYER, Press to roll the dice

3 and 2 for a 5

HUMAN PLAYER goes first

If there is a tie determining who goes first (i.e. both the Human and Computer roll the same value), a message is printed stating so, and the process is repeated until two different values are rolled. The highest roll then goes first.

After determining which player goes first, 24 spaces are displayed in two lines, each represented by a number enclosed in square brackets (12 numbers in each line) and separated by tabs. The only exception is the last space which doesn't use bracket but instead is displayed as <24>. A character before a number indicate that it is a special space. A goose is represented by '+', the bridge by '*', a maze by '-' and the skull by '!'. The following table indicates the special spaces:

Symbol

Spaces

Action

goose

7, 11, 15

move your piece again by the same distance

bridge

6

go to space 12

maze

13, 20

go back to your previous space

skull

23

return to the beginning

The characters '$' and '%' are used to represent the pieces of human and computer player, respectively. When a player lands on a space, the space number is NOT displayed but only the player instead. If both players are in the same space, human's character is always shown first.

Playing the game:

  • After selecting play in the main menu the goose board is displayed with both players' pieces in the start position.

  • Below the board, a message is displayed indicating which player will next roll the dice (assuming a player didn't win the previous roll). This information should be shown in a manner similar to:

[HUMAN/COMPUTER] PLAYER'S TURN, [current space]... Press to roll the dice

  • After the player presses (the human player should also "roll" for the computer) the value of each die along with the sum of both dice is shown. The next line shows a summary of the main movements performed in that roll. If more than one movement is carried out, a comma separates each movement. The main possible movements are:

    • go to space #

    • come back to space #
    • return to start
  • After the main movements are performed, the new board status is shown

  • If the new board status shows that the player won during the roll, a message is displayed indicating that the game is over, and stating which player (Human or Computer) wins:

"-GAME OVER-" Player # won!

  • Then the following message is displayed, allowing the user to return to the main menu:

Press to return to the main menu

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

LO1 Identify why performance management is necessary.

Answered: 1 week ago