Write a script to simulate each player’s chances of winning

Assignment Help Basic Computer Science
Reference no: EM131412603

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.

Reference no: EM131412603

Questions Cloud

University library-kudler fine foods virtual organization : Use the Virtual Organization link on the student website to access additional company information on Kudler Fine Foods. Use the Virtual Organization link on the student website to access additional company information on Kudler Fine Foods.
Simulate bacteria growth : So for p=0.75, p(E) is expected to be 1/3. But for p≤0.5, p(E) is expected to be 1, which means that extinction is certain (a rather unexpected result). You can use your script to test this theory by running it for different values of p, and estim..
Translate statements into symbolic form- jaguar and porsche : Translate the following statements into symbolic form using capital letters to represent affirmative English statements.- Not both Jaguar and Porsche make motorcycles.
Select a client problem that you think calls for ct or cbt : Similar hypotheses underpin cognitive therapy (CT) and cognitive-behavioral therapy (CBT), yet the application of each is different when working with clients. CT involves adjusting how clients think and feel. CBT involves adjusting how clients thi..
Write a script to simulate each player’s chances of winning : Write a script to simulate each player's chances of winning, if they always play at random.
Female reproductive system external genitalia diagram : Female Reproductive System External Genitalia Diagram. Locate, label and color each of the structures and regions listed below on the black and white unlabeled external genitalia (vulva) diagram found in the assignment section.
How the histogram changes each time : Simulate such an experiment 200 times by generating 200 random numbers with this mean and standard deviation. Plot the histogram (use 10 bins).
Translate statements into symbolic form- motorcycles : Translate the following statements into symbolic form using capital letters to represent affirmative English statements.- Both Jaguar and Porsche do not make motorcycles.
Explain how family systems theory applies to your family : Understanding your family system can help provide useful information when working with families. Family systems may be open or closed. Open family systems involve acceptance of all family members as equal participants in the family. For example, c..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Project manager must focus on to ensure success

Identify the three primary areas a project manager must focus on to ensure success. Explain which area you feel is most important and why.

  Find the area under the graph

Write an equation of a function for which you would need the formula for 14 + 24 + 34 + ... + n4 to find the area under the graph.

  Calculate the flow-stream temperature

The plate temperature is measured as 100?C, ±0.5?C, and the room temperature surrounding the plate is at 20?C, ±0.5?C. Using emissivity data from the appendix, calculate the flow-stream temperature and estimate its uncertainty.

  Determine the steady-state temperature of the panel

If the panel were a thin plate without the solar cells, but with the same radiative properties, determine the temperature of the plate for the prescribed conditions. Compare this result with that from part (a). Are they the same or different? Expl..

  What is the difference between the if then elseif

What is the difference between the If Then ElseIF clause and a Nested If Block? Please provide examples of how you would use each.

  What is the speed difference between the two programs

What is the speed difference between the two programs?

  Regards to the order of hierarchy

Q1. With regards to the order of hierarchy, what is the best possible scenario in terms of controlling risk?Q2. What is the hierarchy of control from most to least preferred?

  Writing java code by using netbeans

Write a java code using netbeans for the following program. Write a program that asks the user to enter five test scores.

  Classes implemented without the generic syntax

The syntax of generic classes and methods was not added until version 5.0 of Java. Nonetheless, early versions of the language had collections classes such as an array list, or a linked list. How were those classes implemented without the generic sy..

  Difference between master test plan and test plan

Question: What is difference between Master Test Plan and Test Plan.

  Design of the logic circuit

Kyle, Patrick, Jorge and Steven are hungry college students. They want a quicker way to decide where to go for lunch, the Marshall Center or Juniper. The majority wins, except when Jorge and Steven both agree, then they win. Any other ties end wit..

  Draw pictures of the list names afte

Draw pictures of the list names after each line of the following code. Show the head pointer of the list, and the values and next pointers of every node. Draw pointers as arrows, and the null pointer as a slash or X. You may assume the list is sin..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd