Question: Candy.cpp------------------------------------------------------------------------------------------- #include #include #include #define GAME_LENGTH 50 void advancePlayerA(int* ptrPlayerA); void advancePlayerB(int* ptrPlayerB); void printPosition(int* ptrPlayerA, int* ptrPlayerB); int main() { } For this assignment,

 Candy.cpp------------------------------------------------------------------------------------------- #include #include #include #define GAME_LENGTH 50 void advancePlayerA(int* ptrPlayerA); void

advancePlayerB(int* ptrPlayerB); void printPosition(int* ptrPlayerA, int* ptrPlayerB); int main() { } For

Candy.cpp-------------------------------------------------------------------------------------------

#include

#include

#include

#define GAME_LENGTH 50

void advancePlayerA(int* ptrPlayerA);

void advancePlayerB(int* ptrPlayerB);

void printPosition(int* ptrPlayerA, int* ptrPlayerB);

int main()

{

}

For this assignment, we are going to explore how we can use pointers, functions, and conditionals in C++ to create a simulation of the popular children's game Candy Land. In our "game" two players (you and a friend) will attempt to be the first to successfully reach King Kandy at the Candy Castle through a series of random chance movements. The goal is for you to be the first to reach the Castle and win the game For simplicity, let us assume that the following are the rules to our version of the game The game is . Each turn you will "draw" a card that will instruct you to either move forward one (1) space, two made up of 50 spaces-space #50 is the Candy Castle and thus the winning space (2) spaces, or encounter a Special Spot (these spots can be both good and bad) Special Spot Movement o Mountain Pass: Move forward three (3) spaces. Rainbow Trail: Move forward five (5) spaces Cherry Pitfalls: Move backward three (3) spaces Molasses Swamp: Move backward five (5) spaces. " . You and your friend cannot occupy the same space - if this occurs you must move backward one (1) space The player that reaches the 50th space first is declared the winner . There is one catch - your friend tends to get very lucky when drawing Special Spot cards from the deck. Despite this "advantage" you are determined to beat your friend to Candy Castle can you do it!? We will use the following table to outline the probability of "drawing" a respective card: Movement Type Move Forward 1 Move Forward 2 Mountain Pass Rainbow Trail Cherry Pitfalls Molasses Swam Probability 4000 20% 10% 10% 10% 10% Move Forward 1 Space Move Forward 2 Spaces Move Forward 3 Spaces Move Forward 5 Spaces Move Backward 3 Spaces Move Backward 5 Spaces You Move Forward Move Forward 2 Mountain Pass Rainbow Trail Cherry Pitfalls Molasses Swam 30% 10% 20% 10% 20% 10% Move Forward 1 Space Move Forward 2 Spaces Move Forward 3 Spaces Move Forward 5 Spaces Move Backward 3 Spaces Move Backward 5 Spaces Your Friend

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!