Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please note to COMMENT code and need to indent code, attach screenshots of the code along with the solution. Please DOUBLE CHECK all the classes
Please note to COMMENT code and need to indent code, attach screenshots of the code along with the solution. Please DOUBLE CHECK all the classes and declarations of objects. Thank you
Objectives: Provide a game solution using C++ language. It is important that we can use a set of C++ features to solve problem. Develop solutions that use class features for C++. Create "*.h" files and "*.cpp" files for classes. Description: 1. Part 1 - Required Assignment: create a reference and a pointer a. Create a better dice game from the game of Lab Assignment 3. In this version each player (user or computer) has 2 dices. And you are required to use 1 reference variable and 1 pointer variable. You need to indicate where you use these in your code. b. The winning rule is as follows: if 2 dices of a player have the same value as a pair of 6 and the other player does not have a pair hen a pair of value will win. So, 5&5 will beat 6& 4 because 5&5 is a pair. If both players have pairs, (user and computer), the higher pair will win. For example, 6&6 will beat any pair. If both players do not have pair, then higher total points will win. The output of the program may be like the following Welcome to the dice ware game. You have 100 in your game purse Enter a bet amount to play (O means exit the program): 10 You have 5 & 5 computer has is 3 & 4 You won 10 dollars! Your game purse now has 110 dollars Enter a bet amount to play (O means exit the program): You have 6 & 4 computer has is 1 & 1 You lost 5 Your game purse now has 105 dollars Enter a bet amount to play (0 means exit the program): 10 You have 1 & 2 computer has is 3 & 4 You lost 10 Your game purse now has 95 dollars Enter a bet amount Enter a bet amount to play (0 means exit the program): You choose to exit the program. Thank you and goodbye 2. Part 2 - Optional Assignment: Tortoise and Hare race a. Create class(es) to implement tortoise and hare objects. For every tick of time each animal will move. b. Each animal will run within its lanes; so, no collision will happen. Both will start at possition of 1 and when one reaches mark 70, it will win, (or it will be in a tie if the other animal reach mark 70 at the same time). C. Each animal will move according to its pattern shown below. Note that it may slip back to the left but it should not slip lower than mark 1. Animal Move type Percentage of the time Actual move Tortoise Fast plod 50% 3 squares to the right Slip 20% 6 squares to the left Slow plod 30% 1 square to the right Sleep 20% No move at all Big hop 20% 9 squares to the right Big slip 12 squares to the left Small hop 30% 1 square to the right Small slip 20% 2 squares to the left d. A race could happen like the following output Rabbit pos: 10, tortoise pos: 1 --------- ----------- T...... ....... Rabbit pos: 11, tortoise pos: 4 ----------R--- --- -- ----------- Rabbit pos: 11, tortoise pos: 7 ---------- --------------------- Rabbit pos: 9, tortoise pos: 10 ------ --R ----- --- Rabbit pos: 7, tortoise pos: 13 Rabbit pos: 34, tortoise pos: 68 ------R----- ------ -- Rabbit pos: 43, tortoise pos: 71 R -- TORTOISE WON Press any key to continue ... e. Another run: Rabbit pos: 1, tortoise pos: 2 R - -===- -------- ---- ----- --------------- -------------- ------- ------- -------------------- Rabbit pos: 61, tortoise pos: 25 -------- ---- ---- ------------- ----- Rabbit pos: 70, tortoise pos: 19 -------------- ------------- ---------------- Rabit won! Press any key to continue ... Turn in Instruction Create a PDF file that has code and run output of the part 1 assignment. You do not need to turn in part 2 because it is an optional assignment Upload to Canvas at "Lab Assignment 4" section Miscellaneous Information Hint: you should build your program by creating a small prototype at first, and slightly improve to better prototype(s) with a few additional codes. Make sure the current prototype is free of errors, before creating a better prototype. This is called stepwise refinement approach in write code for an appStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started