Question
HW at hand: Lang is c++ (this is just an outline of my ideas for the game does not run). (must use command line to
HW at hand:
Lang is c++ (this is just an outline of my ideas for the game does not run). (must use command line to run and store values in array)
(need help with program).
#include
#include
#include
using namespace std;
// holding dice??????
void diceroll (){
int rollOne = (rand() % 6 + 1);
int rollTwo = (rand() % 6 + 1);
int rollThree = (rand() % 6 + 1);
int rollFour = (rand() % 6 + 1);
int rollFive = (rand() % 6 + 1);
int rollTotal = (rollOne + rollTwo + rollThree + rollFour + rollFive);
}
//some idea
void randomcommands() {
string command;
while (command != "roll")
{
cout
cin >> command;
if (command == "hold.dice1");
int rollOne = 0;
if (command == "hold.dice2");
int rollTwo = 0;
if (command == "hold.dice3");
int rollThree = 0;
if (command == "hold.dice4");
int rollFour = 0;
if (command == "hold.dice5");
int rollFive = 0;
}
}
// ask the user to play the game
void introthings() {
cout
cout
}
void displaylist(int category, int value)
{
cout
switch (category + 1)
{
case 1: cout
case 2: cout
case 3: cout
case 4: cout
case 5: cout
case 6: cout
case 7: cout
case 8: cout
case 9: cout
case 10: cout
case 11: cout
case 12: cout
case 13: cout
case 14: cout
}
cout
}
int main(int argc, char *argv[]) {
char TheUser;
cout
cout
cout
if (argc == 2 && (argv[1][0] == '1' || argv[1][0] == '2'))
cout
else
cout
do
{
introthings();
cout
cin >> TheUser;
} while (TheUser == 'y' || TheUser == 'Y');
introthings();
system("pause");
return 0;
}
//score card
int Createscorecardplayer(int number_of_players) {
int n = 2;
// n = number of players
int ScoreCards[2][13];
int *arr[13];
for (int i = 0; i
arr[i] = (int *) new int[number_of_players];
for (int i = 0; i
for (int j = 0; j
arr[i][j] = -1;
}
//int ScoreCards;
//ScoreCards = new *int num_of_players;
//for (int i->number_of_players);
}
}
void playerturn(int player) {
int[5] = RollDice();
ReadUserInput();
switch
(1, 2, 3, 4, 5);
// RerollDice();
// AddScoreToCard();
// ErrorMessage();
}
void displayscoreoptions(int player, int diceroll) {
Ones(diceroll, false);
Twos(diceroll, false);
}
void Ones(int[5] diceroll, player, bool write_to_score_card) {
int total = 0;
if (arr[0][player] != -1)
return;
total = 0;
/// Checks each dice to see if it is one
/// If it is add to total
if (write_to_score_card)
Scorecard[0][player] = total;
else
/// Print it out for the user
Print "A - Ones - 3";
}
int ReadUserInput() {
}
(90 pts) Problem Statement: Write a C++ program that plays the game of Yahtzee. Here are instructions for playing the game: http://www.hasbro.com/common/instruct/Yahtzee.pdf You can also find a mobile version to play in the Google play store or App store. Your game will allow 1-2 players, and at the end, you need to ask if the user wants to play again and with how many players. There are 5 six-sided dice in the game and you get three rolls to try to make something on the scoresheet. You must use an array to hold the values of the 5 dice and an array to hold the scores for the 16 categories for a player The top half of the scoresheet is only a sum of 1 or more of dice you are trying to get 1s, 2s, 3s, 4s, 5s, and 6s, and if you score 63 or more points in this section, you get an additional 35 points. The bottom half of the scoresheet consist of options that have pre-defined points or a total of all the dice. You have the options for a three of a kind (total of all dice, but has to have 3 or more of the same number), four of a kind (total of all dice, but has to have 4 or more of the same number), full house (25 pts, 2 dice the same and 3 dice the same) small straight (30 pts, 4 numbers in a row), large straight (40 pts, 5 numbers in a row) Yahtzee (50 pts, 5 dice the same number), up to 3 bonus Yahtzees (100 pts each, 5 dice the same number), and chance (total of all dice, any combination) After your first roll, a player can choose to roll 0-5 specific dice again. The player needs to state how many dice they want to re-roll and which ones they want to re-roll by providing the array indices for each die. If the player chooses not to roll again or has rolled 3 times, then the player must choose a category not previously chosen on the scoresheet. If the dice do not match the rules for that category, then the player take 0 for that category. Once a category has a score (even a zero score), it cannot be chosen again, so think carefully about what value you are going to use to initialize the scoresheetStep 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