Question: Pig is a 2 - player game played with a 6 - sided die. On your turn, you can decide either to roll the die

Pig is a 2-player game played with a 6-sided die. On your turn, you can decide either to roll the die or to pass. If you roll the die and get a 1, your turn immediately ends and you get 1 point. If you instead get some other number, it gets added to a running total and your turn continues (i.e. you can again decide whether to roll or pass). If you pass, then you get either 1 point or the running total number of points, whichever is larger, and it becomes your opponents turn. For example, if you roll 3,4,1 you get only 1 point, but if you roll 3,4,2 and then decide to pass you get 9 points. The first player to get to 100 points wins. Suppose at some point the player whose turn it is has x points, their opponent has y points, and the running total for this turn so far is z. Lets work out what the optimal strategy is.4.A.(5 pts.) Let W(x, y, z) be the probability that the current player will eventually win if both players play optimally. What is W(x, y, z) if x + z 100?4.B.(5 pts.) Suppose the current player decides to roll, and gets a 1. Whats the probability that theyll still win, in terms of the function W?4.C.(5 pts.) Give a recursive formula for W(x, y, z).4.D.(5 pts.) Describe a dynamic programming algorithm to compute W(x, y, z). If you needed N points to win instead of 100, what would be the asymptotic runtime of your algorithm?

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 Programming Questions!