Question

In: Computer Science

The game of Pig is a simple two-player dice game in which the first player to...

The game of Pig is a simple two-player dice game in which the first player to reach 100 or more points wins. How to play: Players take turns rolling one six-sided dice and following these rules: If the player rolls 2 through 6, then he/she can either a. “Roll Again” or b. “Hold” At this point, the sum of all rolls is added to the player’s score, and it becomes the other player’s turn. If the player rolls 1 before he/she decides to stop rolling, the player scores 0 for that round and it's the other player's turn. Write a program that plays the game of Pig, where one player is a human and the other is the computer. Your program should have a GUI interface. At the beginning or after each game, the player should be able choose either “start a new game” or “look up history records”. If the user selects “Look up History Records”, he/she will see a list of all games played on that machine so far, with four columns: Game result: win or lose Date and time Total points Who is the player: computer or human The user should be able to sort the list in different ways by clicking on each of the column title. in Java

Solutions

Expert Solution

Here i am providing the answer. Hope it helps. please give me a like. it helps me a lot.

Thank you. please upvote.


Related Solutions

PYTHON GAME OF PIG The game of Pig is a simple two player dice game in...
PYTHON GAME OF PIG The game of Pig is a simple two player dice game in which the first player to reach 100 or more points wins. Players take turns. On each turn a player rolls a six-sided die. After each roll: a) If the player rolls a 1 then the player gets no new points and it becomes the other player’s turn. b) If the player rolls 2-6 then they can either roll again or hold. If the player...
In a dice game a player first rolls two dice. If the two numbers are l...
In a dice game a player first rolls two dice. If the two numbers are l ≤ m then he wins if the third roll n has l≤n≤m. In words if he rolls a 5 and a 2, then he wins if the third roll is 2,3,4, or 5, while if he rolls two 4’s his only chance of winning is to roll another 4. What is the probability he wins?
Two players A and B play a dice game with a 6-face fair dice. Player A...
Two players A and B play a dice game with a 6-face fair dice. Player A is only allowed to roll the dice once. Player B is allowed to roll the dice maximally twice (that is, Player B can decide whether or not she or he would roll the dice again after seeing the value of the first roll). If the player with the larger final value of the dice wins, what is the maximal probability for Player B to...
PROGRAMMING IN C-DICE GAME Q1. A player rolls two dice at the same time. Each die...
PROGRAMMING IN C-DICE GAME Q1. A player rolls two dice at the same time. Each die has six faces, which contain 1, 2, 3, 4, 5 and 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. (i) If the sum is 2 or 10 on the first throw, the player wins. (ii) If the sum is 3, 7 or 12 on the first throw, the player loses. (iii)...
In order to win a game, a player must throw two fair dice and the sum...
In order to win a game, a player must throw two fair dice and the sum of the dice needs to be either 4 or less or 10 or more for the player to win. What is the probability that the sum of the dice is 4 or less? What is the probability that the sum of the dice is 10 or more? What is the probability that the player will win the game?
This problem concerns the dice game craps. On the first roll of two dice, you win...
This problem concerns the dice game craps. On the first roll of two dice, you win instantly with a sum of 7 or 11 and lose instantly with a roll of 2,3, or 12. If you roll another sum, say 5, then you continue to roll until you either roll a 5 again (win) or roll a 7 (lose). How do you solve for the probability of winning?
In the game of craps, a player (known as the shooter) rolls two fair six-sided dice....
In the game of craps, a player (known as the shooter) rolls two fair six-sided dice. The shooter immediately loses if the sum of the dice is 2, 3, or 12 and immediately wins if the sum of the dice is 7 or 11 on the first roll. If the sum is anything else (4, 5, 6, 8, 9, or 10), that number becomes the point and the shooter rolls again. The shooter now wins by rolling that same point...
Consider the following two-player game, in which Player 1 is the IMF, and Player 2 is...
Consider the following two-player game, in which Player 1 is the IMF, and Player 2 is a debtor country. Reform Waste Aid 3, 2 -2, 3 No Aid -2, 1 0, 0 a) Compute all (pure and mixed) Nash equilibria. b) Do you think that the above game is the case of a resource curse? Interpret the game with a story of a resource curse.
Java: Simple 21 Game (Blackjack) In this game, the dealer deals two "cards" to each player,...
Java: Simple 21 Game (Blackjack) In this game, the dealer deals two "cards" to each player, one hidden, so that only the player who gets it knows what it is, and one face up, so that everyone can see it. There are four players: one human player (user) and three computer players. The players take turns requesting cards, trying to get as close to 21 as possible, but not going over 21. A player may pass. Once a player has...
In the game of Lucky Sevens, the player rolls a pair of dice. If the dots...
In the game of Lucky Sevens, the player rolls a pair of dice. If the dots add up to 7, the player wins $4; otherwise, the player loses $1. Suppose that, to entice the gullible, a casino tells players that there are lots of ways to win: (1, 6), (2, 5), and so on. A little mathematical analysis reveals that there are not enough ways to win to make the game worthwhile; however, because many people’s eyes glaze over at...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT