#include #include "dice.h" #include "prompt.h" // Name: // // Course: CPS 6 // // Section no: // // Date: // // Purpose: int RollTwoUntilNum (int target) // pre: 2 <= target <= 12 // post: returns number of rolls needed to obtain target { } int RollUntilDoubles (int target) // pre: 1 <= target <= 6 // post: returns number of rolls needed to obtain target on two dice { } int AvgRollsToDoubles (int target, int tries) // pre: 1 <= target <= 6 // post: returns average number of times needed to obtain target on two dice // (average is computed by summing results from tries times) { } int PigRound (int points) // pre: 0 <= points < 100 // post: returns points after playing a single round of the game Pig { } // test oneRound by trying to play a game to some max value // note, asks to continue after each round so loop does not // go on forever void PlayPig (int max) { cout << "Playing a game of PIG until we win:" << endl; int score = 0; int numRounds = 0; while (score < max) { score = PigRound(score); numRounds++; cout << " score after round " << numRounds << " : " << endl; // comment this out if you do not want to monitor the game if (!PromptYesNo("Continue? ")) { break; } } cout << endl; } int main () { // Add code here to test warm-up functions // Add code here to test specific pig round situations // finally try to play a game to 100 PlayPig(100); return 0; }