BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

c++代写 | How to Play LCR Dice Game

c++代写 | How to Play LCR Dice Game

c++任务_实现骰子游戏

Project Plan&UML
How to Play LCR Dice Game

******************How to Play LCR Dice Game***********************************
The LCR dice game is a fast-moving game that anyone can play. It requires
three or more players.
The dice has 6 faces. the face of 1,2,3 is “o”, the 4 is L, 5 is C, 6 is R.
Players start with 3-5 chips, then randomly select a player to roll the dice.
On this turn the number of dice you roll depends on the number of your chips:
* 3 or more chips, roll all 3 dice.
* 2 chips, roll 2 dice.
* 1 chip, roll 1 dice.
* no chips, no roll dice.
After rolling the dice, check the value of each die one:
* Roll the L, give one of your chips to the player on your left.
* Roll the C, put one of your chips in the pot in the center.
* Roll the R, give one of your chips to the player on your right.
* Roll the others, nothing happens.
If you lose all your chips, you aren’t out of the game but you only will have no
chips no roll dice on your turn. Other players maybe still give you chips.
**************************Game End and Winning********************************
When only one player has chips remaining, that player is the winner.
The winner is this player and get all chips from the center pot.
**********************************************************************************
Wild dice:
One face on each die is marked with a Wild symbol:
If you roll any Wilds on your turn, take the following action:
* Roll 1 Wild, get one chip from any opponent.
* Roll 2 Wilds, get two chips from any opponent.
* Roll 3 Wilds, get all the chips from the center pot, win the game instantly.
Dice Effect:
On the player’s turn, you can select the dice as normal or reverse , and need pay
3 of your chips to the center pot to change the effect of the dice from give to get.
* Roll the L, get one of your chips to the player on your left.
* Roll the C, get one of your chips in the pot in the center.
* Roll the R, get one of your chips to the player on your right.
* Roll others, nothing happens.
********************************************************************************** ”For the player to clearly understand how to play the game, at the beginning
of the game, I will display the above content.
I saved the above content to a document that will be automatically loaded
when the game starts. The name of the doc is “LCRDiceRules.txt”. This rule is not hard-coded into
C++ code, and I can easily modify the rule document without having to
recompile the C++ code. Development Outline for LCR Dice Game
After understanding the requirements and functions of assignment 3, I think
the following four classes can meet the requirements and all functions,
including the extra functionality in the assignment: a Player class, a Die
Class and a LCRDiceGame class, a SetResult class.
I will explain the functions of each class below:
◆ Player class:
This class is used to store the player’s name, the number of chips, and
includes a Boolean fag identified whether or not the player is a
computer role. It provided to manipulate chips, such as adding one chip, and decreasing one chip, to determine whether the player is computer
or human, and the player whether has chips or not. ◆ Die class:
I will define Die class which can support faces change. It also can be
update to new faces and is very convenient to expand the new dice from
the die. I will provide the roll function which can randomly generate a
face from the defined faces list. ◆ LCRDiceGame class:
It is the most important class. It Implemented the main logic and main
loop. At the beginning, it accepts user input to configure some
parameters of the game. For example, whether to support multiple
player, the player’s name, the number of chips when the game start-up.
It provides a main loop that lets the player roll the dice in a clockwise
order. In the player’s turn, the player’s score is updated according to the
rules of the game. ◆ SetResult class:
Only for multiple player, this class is stored the information of one set,
including who won this game, how many gold chips he or she won, the
index of this set.
The Game Setup
◆ In the program start-up, the contend of “LCRDiceRules.txt”will be
loaded and displayed, and show the “Press any key to continue…”. ◆ Check whether there is a stored file of the previous game by the human
player. The file name is “game.txt”.
If not this file, the game will continue..
If have the file, notify load the file. If the player choose to load, the game
will use the game configuration information which is saved. If not loaded, the game continues. ◆ Initial the game variables. If restore from file, skip the step. ➢ Let the player choose whether to play multiple to determine the
overall player. ➢ Let the player input the number of chips for each player at start-up. The range is from 3 to 5. If the value is out of range, need re-input. ➢ Let the player choose whether to enable wilds. ➢ Input player information
There are 3 options for players. ⌑ Human: add human player, need input the name of player. ⌑ Computer: add computer player, I will use “Computer X” as the
Player name. According to the number of computer players, “X” will increase. ⌑ Quit: quit the step, continue game. ◆ Clear the screen and randomly select a player to start the game. The Game Round and Examples of Player Feedback
Use “*” print head for more beautiful display. At the beginning, the program will randomly select a player to finish. After the
player roll their dice, then play continues in clockwise order. **************************************************************************
* *
* LCR :: A dice game for 3 more player *
* *
* ** ******** ******* *
* ** ** ** ** *
* ** ** ** ** *
* ** ** ** ** *
* ********* ******** ** ** *
* *
**************************************************************************
Show the number of chips for each player in the round. Wait the current player
to input dice effects or quit? If the player is computer, the game will select the
normal or reverse effect randomly.
If play multiple games, show all set result and current set information. **************************************************************************
Set: 3/3 Round: 1
Set 1 Winner: Computer 1 Chips: 9
Set 2 Winner: Computer 1 Chips: 9
**************************************************************************
If not play multiple games and play one time, only display the round: **************************************************************************
Round: 1
**************************************************************************
POT Total: 0
Computer 1 Total: 4
Computer 2 Total: 4
Computer 3 Total: 4
test Total: 4
**************************************************************************
It is your’s turn, test
Do you want to [Q]uit or roll the dice as [N]ormal or [R]everse effects?
After receive the choose from the player ,
if “R” or “N”, The game displays several plugs and results based on the player’s
choice and the number of coins. You choose to roll the dice as Normal in this turn.
.—. .—. .—.
: C : : L : : o :
‘—‘ ‘—‘ ‘—‘
You put a chip to the POT…
You give a chip to Computer 1.
A lucker roll… You keep your chip!
Press any key to continue…
If “Q”, notify the player save the game, the game exit. After the player finish her turn, check if a winner is generated. If yes, print the
win name and the number of chips.
**************************************************************************
The final winner is Computer 1 Chips: 16
**************************************************************************
If it is play multiple games mode, continue to the next set until all set is done.
if not, the game is over and exit. All game set is over, please see the result: **************************************************************************
Set 1 Winner: Computer 1 Chips: 9
Set 2 Winner: Computer 1 Chips: 9
Set 3 Winner: Computer 1 Chips: 9
**************************************************************************
The final winner is Computer 1 Chips: 3
************************************************************************** saved and restored the player’s request
For store the player’s game progress, I will need store the game information
to one file which name is “game.txt”. When the game is started, check
whether the file exists or not. If exists, notify the user whether loaded the
previous game or not.
I will use the following function to implement:
◆ bool restoreGame();
◆ bool saveGame();
The following information will be saved into the game
◆ all player info: name, the number of chips, the compute flag. ◆ current round number
◆ current set number
◆ current player index who is the turn. ◆ Whether play multiple games
◆ Whether play with Wilds
◆ The number of the chips in center pots. ◆ the number of chips all players start with
◆ all set result info
Processing Player Input
We needs to accept user input multiple times in the game. ◆ Integer: Used for asking the number of chips all players start with. ◆ Single character option : Used for asking the opt(Y/N,R/Q/N). ◆ String: Used for asking the player for the name.
I will use the following function to implement:
◆ int askForNumber(const string &question) const;
◆ char askForChar(const string &question) const;
◆ string askForString(const string &question) const;
The End Game Conditions
This game has two end game condition:
◆ After each round is completed, check if only one has chips, and other
players are 0, the game is over immediately. ◆ The game starts with the configuration wilds. When a player gets 3 “W”s, the game is over immediately. ◆ If the game is over, showing the current player win home information, if
not continue. ◆ If the game is configured multiple times, you need to continue to the
next set unit. The number of game set should be equal to the number of
players. Additional Features Included
I have decided to include the following 7 extra features in my game:
◆ The player can set the number of chips each player starts with.
I will add one member variable “numChips” in LCRDiceGame class. It
can be configurable by the player input. ◆ The player can choose to play multiple games to determine an overall
winner.
I will add one member variable “isMultiGame”in LCRDiceGame class. It
can be configurable by the player input and use the class SetResult to
store the game set info. ◆ Display the dice using ASCII art using a formatted string.
I will add the show() function in Die class,it is static function for all Die. ◆ Allow the game to be saved and restored at the player’s request.
I will use restoreGame() and saveGame() to implement the feature. The
core is write/read the game info to/from the file with the same order. ◆ Create a Die class to hold the details of and manipulate each die.
implement one Die class to create dice and roll for each die. ◆ Allow the game to include the use of Wild values and options.
I will add one member “enableWilds” in LCRDiceGame class. It can be
configurable by the player input. Use it to check calculate the transfer of
chips. ◆ Allow the player to choose Normal or Reverse dice effects. The player can choose it in any their turns. According to user’s choice,
calculate the transfer of chips. UML Class Diagrams
I design the UML diagrams with StarUML.

bestdaixie