Question

I need some help creating C++ Left, Center, Right (LCR) dice game Pseudocode. Address the following : A. Analyze the giv...

I need some help creating C++ Left, Center, Right (LCR) dice game Pseudocode.

Address the following :

A. Analyze the given problem statement.

B. Break the problem down into distinct steps of pseudocode that will solve the problem.

C. Create variables to track the various elements in the pseudocode.

D. If applicable, determine any breakdown of pseudocode into functions and/or classes.

E. Use natural language to work through the problems.

Using three special dice and player pieces called chips. In short, each player on his or her turn rolls the dice. The dice determine how many of the player’s chips have to be moved around to other players. The last player holding chips wins the game.

Here are the rules
Left Center Right (LCR) is a multiplayer dice game with a minimum of three players, but no upper limit on the number of participants. The goal is to win all of the chips.

The Dice

There are three dice rolled each turn. Each die has the letters L, C, and R on it along with dots on the remaining three sides. These dice determine where the player’s chips will go. For each L, the player must pass one chip to the player sitting to the left. For each R, the player must pass one chip to the player sitting to the right. For each C, the player must place one chip into the center pot and those chips are now out of play. Dots are neutral and require no action to be taken for that die.

The Chips
Each player will start with three chips. If a player only has one chip, he/she rolls only one die. If a player has two chips left, he/she rolls two dice. Once a player is out of chips, he/she is still in the game (as he/she may get chips passed to him/her), but passes the dice to the next player.

Winning the Game

The winner is the last player with chips.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Pseudo Code:
// Get number of players

int playerNum

read(playerNum)

int livePlayers = playerNum

// Initialize starting coins

int coins[playerNum]

foreach player : [0, playerNum-1]

coins[player] = 3

// Play game until only one player is not left

while livePlayers != 1

// For each player play dice

foreach player : [0, playerNum-1]

// Roll dice 3 times

for i : [1, 3]

dice = rollDice()

if coins[player] == 0

break

// If dice is L give coin to left player

if dice == L

giveLeft(player)

if coins[left(player)] == 1

livePlayers += 1

coins[players] -= 1

if coins[player] == 0

livePlayers -= 1

break

// If dice is R give coin to right player

if dice == R

giveRight(player)

if coins[right(player)] == 1

livePlayers += 1

coins[players] -= 1

if coins[player] == 0

livePlayers -= 1

​​​​​​​ break

// If dice is C player looses a coin

if dice == C

coins[players] -= 1

if coins[player] == 0

livePlayers -= 1

​​​​​​​ break

// If only one player is left, stop

if livePlayers == 1

break

// Check all player's coin

foreach player : [0, playerNum-1]

// If player has a coin left he is the winner

if coins[player] != 0

write(player)

exit()


Explanation:
Game process is explained in code comments



Comment down for any queries

Please give a thumb up







Add a comment
Know the answer?
Add Answer to:
I need some help creating C++ Left, Center, Right (LCR) dice game Pseudocode. Address the following : A. Analyze the giv...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need help figuring out how to code this in C++ in Visual Studio. Problem Statement:...

    I need help figuring out how to code this in C++ in Visual Studio. Problem Statement: Open the rule document for the game LCR Rules Dice Game. Develop the code, use commenting to describe your code and practice debugging if you run into errors. Submit source code. Use the document to write rules for the user on how to play the game in a text file. Then, using the information from the resource articles, create a program that will read...

  • The game of Pig is a simple two-player dice game in which the first player to...

    The game of Pig is a simple two-player dice game in which the first player to reach 100 or more points wins. Players take turns. On each turn, a player rolls a six-sided die: If the player rolls a 1, then the player gets no new points and it becomes the other player’s turn. If the player rolls 2 through 6, then he or she can either ROLL AGAIN or HOLD:      At this point, the sum of all rolls...

  • Two player Dice game In C++ The game of ancient game of horse, not the basketball...

    Two player Dice game In C++ The game of ancient game of horse, not the basketball version, is a two player game in which the first player to reach a score of 100 wins. Players take alternating turns. On each player’s turn he/she rolls a six-sided dice. After each roll: a. If the player rolls a 3-6 then he/she can either Roll again or Hold. If the player holds then the player gets all of the points summed up during...

  • The Rules of Pig Pig is a folk jeopardy dice game with simple rules: Two players...

    The Rules of Pig Pig is a folk jeopardy dice game with simple rules: Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 (”pig”) is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player’s turn, the player is faced with two decisions: roll If the player rolls a 1: the player scores nothing and it becomes the...

  • C# Code: Write the code that simulates the gambling game of craps. To play the game,...

    C# Code: Write the code that simulates the gambling game of craps. To play the game, a player rolls a pair of dice (2 die). After the dice come to rest, the sum of the faces of the 2 die is calculated. If the sum is 7 or 11 on the first throw, the player wins and the game is over. If the sum is 2, 3, or 12 on the first throw, the player loses and the game is...

  • Please i need helpe with this JAVA code. Write a Java program simulates the dice game...

    Please i need helpe with this JAVA code. Write a Java program simulates the dice game called GAMECrap. For this project, assume that the game is being played between two players, and that the rules are as follows: Problem Statement One of the players goes first. That player announces the size of the bet, and rolls the dice. If the player rolls a 7 or 11, it is called a natural. The player who rolled the dice wins. 2, 3...

  • For your final project you will incorporate all your knowledge of Java that you learned in this class by programming the game of PIG. The game of Pig is a very simple jeopardy dice game in which two p...

    For your final project you will incorporate all your knowledge of Java that you learned in this class by programming the game of PIG. The game of Pig is a very simple jeopardy dice game in which two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn,...

  • C or C++ Project Overview Wild, Wild, West! Dice Game The Wild, Wild, West! is an...

    C or C++ Project Overview Wild, Wild, West! Dice Game The Wild, Wild, West! is an elimination dice game. It can be played by any number of players, but it is ideal to have three or more players. Wild, Wild, West! Requires the use of two dice. At the start of the game, each player receives a paper that will track the number of lives that player has. Each player starts the game with 6 lives. In the first round,...

  • can someone help me with this C++ problem write your game() function and 3+ functions that...

    can someone help me with this C++ problem write your game() function and 3+ functions that simulate the game of Jeopardy Dice according to the following game mechanics and specifications. Game Mechanics There are two players: the user and the computer, who alternate turns until one of them reaches 80 points or higher. The user is always the first player and starts the game. If any player reaches 80 points or more at the end of their turn, the game...

  • can someone help me fix my jeopardy dice game I am having a hard time figuring...

    can someone help me fix my jeopardy dice game I am having a hard time figuring out what i am doing wrong #include #include using namespace std; //this function makes a number between 1 and 6 come out just like a dice int rollDie() { return (rand() % 6+1); } //this function asks the user with a printed statement if they want to roll the dice and gives instructions for yes and no (y/n) void askYoNs(){ cout<<"Do you want to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT