hello guys,
im having trouble on how to approach this assignment i have for my c++ class, please i would appreciate all kinds of help and advices. thank you in advance.
The game is a one to three players dice game. At the start of the game there are nine tiles numbered 1 through 9. On each turn a player rolls two six-sided dice and “covers” one tile matching one of the dice or the sum of the dice. For example, if the player rolls 3 and 4 she may cover tile 3, 4, or 7. The player keeps rolling the dice until she can’t cover any more tiles. At this point the turn is passed to the next player. If the game is played by a single player, the play goes to the next round.
Scoring: After each turn the player scores one point for each tile covered.
The game ends after ten rounds or when the player covers all tiles. If there are two or three players, the player with the highest score wins. To win a single player game, all tile must be covered (nine points) after at most ten rounds.
Write a menu driven program that plays the Game of Tiles. The menu should be of the following form:
**********************************
Game of Tiles
Main Menu: Please type your selection!
Single Player [single]
Two Players [two]
Three Players [three]
Quit [quit]
**********************************
The menu should be displayed after each game. Only when the user enters “quit” should the program terminate. You must check for input errors.
Once the user has chosen the number of players, each player should be prompted to enter their name. The player to start must be chosen at random.
Example of the user interface (user input is in bold):
You have chosen to play with two players.
Player 1, please enter your name: Susan
Player 2, please enter your name: Andy
Welcome Susan and Andy!! The player who will start is chosen at random.
Round 1: [ 1] [ 2] [ 3] [ 4] [ 5] [ 6] [ 7] [ 8] [ 9]
Andy, please enter ‘r’ or ’R’ to roll the dice: r
First Die: 1 Second Die: 2 Sum: 3
Tiles: [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ]
Andy, please enter the number of the tile that you would like to cover: 3
Round 1: [ 1 ] [ 2 ] [ X ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ]
Andy, please enter ‘r’ or ‘R’ to roll the dice: r
First Die: 3 Second Die: 3 Sum: 6
Tiles: [ 1 ] [ 2 ] [ X ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ]
Andy, please enter the number of the tile that you would like to cover: 6
Round 1: [ 1 ] [ 2 ] [ X ] [ 4 ] [ 5 ] [ X ] [ 7 ] [ 8 ] [ 9 ]
Andy, please enter ‘r’ or ‘R’ to roll the dice: r
First Die: 3 Second Die: 3 Sum: 6
Tiles: [ 1 ] [ 2 ] [ X ] [ 4 ] [ 5 ] [ X ] [ 7 ] [ 8 ] [ 9 ]
Andy, you have lost your turn.
Your score for round 1 is 2. Your total score is 2.
Round 1: [ 1 ] [ 2 ] [ X ] [ 4 ] [ 5 ] [ X ] [ 7 ] [ 8 ] [ 9 ] Susan, please enter ‘r’ or ’R’ to roll the dice:
...
Your program must perform the necessary logic to end a turn and to end the game. You must check for valid user input. For example, if the player enters a number of a tile that is already covered the program should prompt the user to enter a valid tile number.