In: Computer Science
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
Here i am providing the answer. Hope it helps. please give me a like. it helps me a lot.
Thank you. please upvote.