Write a script to simulate each players chances of winning


Two players, A and B, play a game called Eights. They take it in turns to choose a number 1, 2, or 3, which may not be the same as the last number chosen (so if A starts with 2, B may only choose 1 or 3 at the next move). A starts, and may choose any of the three numbers for the first move. After each move, the number chosen is added to a common running total. If the total reaches 8 exactly, the player whose turn it was wins the game. If a player causes the total to go over 8, the other player wins. For example, suppose A starts with 1 (total 1), B chooses 2 (total 3), A chooses 1 (total 4) and B chooses 2 (total 6). A would like to play 2 now, to win, but he can't because B cunningly played it on the last move, so A chooses 1 (total 7). This is even smarter, because B is forced to play 2 or 3, making the total go over 8 and thereby losing. Write a script to simulate each player's chances of winning, if they always play at random.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write a script to simulate each players chances of winning
Reference No:- TGS02209231

Expected delivery within 24 Hours