Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are coding a simple game called Pig in C++. The rules are as follows: Two pl

ID: 3766532 • Letter: Y

Question

You are coding a simple game called Pig in C++. The rules are as follows:

Two players (you and the computer) are racing to reach 100 points.

• Each turn, the active player faces a decision: – Hold: take your turn total and add it to the player's overall total. The next player becomes active. – Roll: generate a random number between 1 and 6. Results are: * ’1’ Lose turn, no turn total added to overall total. All the points you have accumulated this turn are lost. * ’2’..’6’ Add this number to the turn total. Player goes again. • I suggest you keep the computer AI as simple as possible.

Explanation / Answer

#include #include #include using namespace std; int main() { int die; int myScore = 0; int devilScore = 0; int turnScore = 0; char choice; bool change = false; bool weHaveAWinner = false; cout choice; if(choice == 'r'){ die=(rand() % 6 + 1); //Number generator for die if(die > 1){ cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote