Pig is a game that has two players (in our case one human and one computer) that alternate turns. Each player’s goal is to get 100 points rolled on a normal six-sided die first. Each turn consists of the rolling the die repeatedly until you get a 1 or decide to stop. As long as you roll a 2-6, you will add this amount to your total for that turn. But if you roll a 1 during your turn, your turn ends and you receive zero points for that entire turn (erasing all of the progress you made since you last agreed to stop). If you decide to stop rolling at any point in your turn, your points for that turn are then added to the overall score. The overall score is then safe from future rolls. The trick is knowing how long to push it before we should stop and save our gains. See end of this document for an example of a game of pig we should write coding as below In order to explore what is the best strategy for the computer player (i.e. at what score do we stop each computer turn), we need to do some analysis. Our main game assumed that as a computer, the best strategic way to victory would be to stop after 20 points or more per turn. You are going to analyze if this is the best value by using trial and error. Redesign your program so that it is computer_one against computer_two. Alter the total per turn that is necessary for one of the computer players, while leaving the other at 20. (For example 15 against 20). For your test value try one number between 15 and 25. Now place your game in a loop and play 1000 times and report which computer won more. (You must remove all of the output statements once you are sure it is working otherwise it will take too long to run.)

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter6: Looping
Section: Chapter Questions
Problem 4GZ
icon
Related questions
Question

Game Description:

Pig is a game that has two players (in our case one human and one computer) that alternate turns. Each player’s goal is to get 100 points rolled on a normal six-sided die first. Each turn consists of the rolling the die repeatedly until you get a 1 or decide to stop. As long as you roll a 2-6, you will add this amount to your total for that turn. But if you roll a 1 during your turn, your turn ends and you receive zero points for that entire turn (erasing all of the progress you made since you last agreed to stop). If you decide to stop rolling at any point in your turn, your points for that turn are then added to the overall score. The overall score is then safe from future rolls. The trick is knowing how long to push it before we should stop and save our gains. See end of this document for an example of a game of pig

we should write coding as below

In order to explore what is the best strategy for the computer player (i.e. at what score do we stop each computer turn), we need to do some analysis. Our main game assumed that as a computer, the best strategic way to victory would be to stop after 20 points or more per turn. You are going to analyze if this is the best value by using trial and error. Redesign your program so that it is computer_one against computer_two. Alter the total per turn that is necessary for one of the computer players, while leaving the other at 20. (For example 15 against 20). For your test value try one number between 15 and 25. Now place your game in a loop and play 1000 times and report which computer won more. (You must remove all of the output statements once you are sure it is working otherwise it will take too long to run.)

It must be very apparent to me which computer wins. So have the results indicate what strategy (amount) the winning and losing computer used. Doing this portion is worth 15% total of the project, so do this last after you are sure the computer versus human version is working.

 

in python

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning