Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this code. it works but how do I get it to got round by round? when I excecute it, it speeds

I need help with this code. it works but how do I get it to got round by round? when I excecute it, it speeds through the whole thing. Also, I dont know why, but the rules arent displaying.
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
" Debug - 286 Local Windows Debugger : ? ! Player.app Player. h c hh Diceh Final Project_DL.cpp - X nal Project DL (Global Scope El Codicegane cop.cpp: This file contains the main function Program execution begins and ends there. 11 > include "pch." include include include "pice." include "Player." using namespace std; int setPlayers Il function to locate the player who is present in 11 left or right with respect to current player int position(int locator, int layers) Il function to display the dinner Information void winnerDetailsPlayer player) Il function to check who has won the same void check forwinner (Player players[l, intu , bool e ) function to pass the chip either left, richt, Centeroto n ing void pass TheChip Player players[], int layers, inte lled, it player function to perfore the action to play the game depending on the bar void players turn(player players [], int layers, int layer e , bool ) function to start the gameplay void play Gene (Player players), int layers); in function to initialize the players and to start the int main) String variable to hold the cach player name call the function setPlayer) order to get static player players P l ayers for (int i 1 layers Final_Project_DL - Microsoft Visual Studio + Edit View Project Build Debug Team Tools Test Analyze Window Help O. 3- 3 2. - Debug .x86 - Local Windows Debugger - I! cecpp Player.cpp Player.h pch.h Diceh Final_Project_DL.cpp - X Final Project DL (Global Scope) cout > name; players[i].setName(name); players[i].setChips(3); cout > nu of Players while (nunOfPlayers > nurofPlayers; return numofPlayers; ! This fuention accepts two integer variables one is playerfumber and 7 other is number of players. This function is to locate the player who is present in left or right with respect to current player int position(int playerumber, int nu-Players) if (playerfumber (0) return nuwPlayers; else if (playerimber > Players) return a; Eire Solution Code - Description Com Warnings Messages Build IntellSense - File Edit View Project Build Debug O o8 . 1 2 . Dice.cpp Player.cpp Player. h Final Project_DL return ; Team Tools - Debug p chh ! Test Analyze Window Help - x86 - Local Windows Debugger Diceh Final Project DL.cpp - X (Global Scope) else return player timber all winnerDetails() function accept a Player object and displays Til the winner information void winner Details(Player player) cout 0) playeruber - win Count ; 11 check for the winning condition. 1 call the function winnerDetails it (incourt - 1) to display the player winneretails (layers [playerfumber) il function accepts players list, number of players, die rolled and 11 player number vold pass thechip(Player playerstl. et ne lovers, het dietolled, int playertember) - Og Odense Description Code *winner = true; winnerDetails(players [playerNumber]); // Function accepts a players list, number of players, die rolled and 11 player number evoid passTheChip(Player players[], int numPlayers, int dieRolled, int playerNumber) int opponent Number; switch (dieRolled) Case 1: NOUS 129 opponent Number - position(player Number - 1, numPlayers - 1); cout #include #include "Dice.h" using namespace std; // Player class which holds the player's name // number of chips present with player. To // display the player's die value. E class Player // required variables private: int chips; string name; public: // constructor Player(); 17 to set the name of the player void setName(string name); 1/ to get the name of the player string getName(); 1/ to set the chips for the player void setChips(int chips); Il to get the chips left with player int getchips(); 1/ to add chips when other player 11 moves the chip to the respective player void addChips(); Il to display the rules of the game static void directions(); 1/ to display the face value of the die 1 rolled by the player void displayDievalue(int die); // to deduct the chip count when 11 the player has to move the chip 1 to other player void deductChips(int dieRolled); Solution Code from Warnings Description - Messages Build IntelliSense : : Final_Project_DL - Microsoft Visual Studio File Edit View Project Build Debug Team Tools Test Analyze Window Help .0 8 . 12 2. Debug . x86 - Local Windows Debugger. I Dice.cpp X Player.cpp P layer. h p ch. h D iceh Final Project DL.cpp Final_Project_DL - Dice 17 Dice.cpp #include "pch.h" #include "Dice.h" #include #include all rollDice function to roll the die 11 and to return the value of the die rolled cint Dice::rolldice() - rollDicel 101 11 srand(time(NULL)); //determine the side rolled sideRolled = (rand() % 6) + 1; return sideRolled; Team Tools - Debug pchh Test Analyze Window Help .x86 - Local Windows Debugger. Diceh Final Project, DL.cpp Final Project DL - Microsoft Visual Studio File Edit View Project Build Debug 3. 1 2 . Dice.cpp Player.cpp X Playeth Final Project DL Player. include "pch." include "Player." nelude "pice. include chips; 55 56 // addChips() function: to add the chips to the user avoid player::addChips() chips++; 59 60 61 62 63 Joll deductChips() function to deduct the chips from the 17 player when the player has to move the chip either left, / right, to the center pot or do nothig void player deductChips(int dieRolled) switch (dieRolled) 1; 1; case 1: chips - break; case 21 chips - break; case 3: chips break; case 4: break; Case 51 break; case 61 break; - 1; Il dispayDieValue() function to display the current die face value that have been rolled by the player void player displayDievalue(int die Emor List Entire Solution Code Error Warnings Description. Messages Build - Intel Sense Dice.cpp Player.cpp + X Player. h p ch.h Dice.h Final_Project_DL.cpp Final_Project_DL - Player IT die face value that have been rolled by the player Svoid Player::displayDieValue(int die) cout Options ->Debugging Press any key to close this window ... O Te

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions