Summary: The year is 1263, in a time that some people call "the Dark Ages." You have been accused of organizing a
plot to overthrow the local monarch and are now imprisoned in a dungeon full of horrible creatures. The chief jailer is cruel, but noticed your intelligence and took a quick liking to you. On the eighty-seventh day of your imprisonment, the jailer came to you and proposed a game. If you win, you will be allowed to escape to freedom. But, if you lose, you will get fed to the dragon.
To decide your fate, you will play a board game on a simple board: a linear track with 16 sequential spaces numbered from 1 to 15. The "zero" space is marked "Start," and your token is placed on it. The jailer has one silver coin and places it on a random numbered space. The jailer then gives you a gold coin, and you are allowed to place it on any numbered space that you want except that the coins must be placed on different spaces. Once placed, the coins are never moved. After both coins are placed, you roll a fair, six-sided die and move your token forward the corresponding number of spaces. If, after moving the token, it lands on the space with your gold coin, you have instantly won your freedom. On the other hand, if, after moving the token, it lands on the space with the jailer's silver coin, you have instantly lost and become dragon food. If you land on a space with no coin, you roll again and continue moving forward. Anytime your token gets past space 15, you place your piece on to the Start position and that move ends with your token on Start; with your next roll of the die, you again proceed across the board. For example, let's say the token is on space 13. If you were to roll a 1, then you would place the token on space 14; if instead you rolled a 2, then you would place the token on space 15; and if you had rolled a 3, 4, 5, or 6, then you place the token back on Start and that move ends. Your token moves across the board as many times as needed until it lands on a space with a coin. The coins are not moved. In this assignment, you will develop code that allows a user to play this game against the computer; the computer is the jailer and the player is the prisoner. When run, the program should 1) welcome the player to the game; 2) announce which space the jailer has randomly chosen for the silver coin; 3) ask the player on which space they would like to place their gold coin; 4) check that the player has placed their coin on a valid space and, if not, keep asking the player until they provide a valid space; 5) run the game as described above, moving the token random numbers of spaces as with the roll of a six-sided die, each time printing to the screen the result of the die roll and the new location of the token; 6) checking at the end of each move to see if the token has landed on the silver coin, the gold coin, or off the end of the board; 7) reset the token to the Start position anytime it has landed past space 15; and 8) end the game when it lands on a coin, displaying a game-over message appropriate to whether the player has won or lost.
The C++ code can be created using below steps : Initialize silver coin position to random number from 1 to 15. Get gold coin... View the full answer