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

Assignment Help Basic Computer Science
Reference no: EM131406961

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: EM131406961

Questions Cloud

Discuss the efforts of ics-cert : Discuss the efforts of ICS-CERT specifically to the Stuxnet threat and examine its incident response efforts to mitigate this risk against U.S. industrial systems and Explain the role of US-CERT in protecting the nation's industrial systems and an..
What does it mean to be unhealthy : In your initial post, think about the definition of disease and answer the following questions:What does it mean to be unhealthy, and does the word "unhealthy" automatically mean pathology?Does being unhealthy automatically include a drug treatment? ..
What do you think has impacted ability to remember : What do you think has impacted ability to remember? What do think has impacted your inability to remember? (Include examples to support your responses.)
Make a recommendation for one common pto system : Make a recommendation for one common PTO system. Explain your system and why you think this system is the best system for the company.
Write a script to simulate each player’s chances of winning : 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.
Discuss about the pathophysiology and pharmacology : What have you learned in this course about pathophysiology and pharmacology?How will you apply this knowledge to your future health information management profession?
Describe the quality culture within fedex : Describe the quality culture within FedEx. Explain how FedEx can use its quality culture as a competitive advantage - Explain how FedEx has incorporated total quality management
What information is the most important to planning process : What information is the most important to this planning process? Which might be the least important consideration? Conduct research into this problem and cite your reasoning.
Explain the role self-concept plays in ethical communication : Describe self-concept. Explain the role self-concept plays in ethical communication. Describe your self-concept and whether it is generally positive or negative

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Does a network competition always have a winner

Advanced exercise: In a neural network recognizing animals, add additional classes such as predators or herbivores and extra data describing features (sharpness of teeth or bills, speed, etc.).

  How did the evolution of telecom circuit

How did the evolution of telecom circuit, packet, switched networks convinced some companies to switch into a VoIP or packet-based or telecommunication system?

  Analyse the case study and produce a vision document

Analyse the case study and produce a Vision document for a software system to solve the business issue identified in the case study - use case diagram capturing at least all critical and significant use cases that the system will have to support

  How often should computer data be backed up

Research companies that provide online backup solutions for businesses. Which one provides the most cost effective solution for backing up three dozen computers? Can backups be performed automatically as employees change data files?

  Describe a communication matrix and its function

Describe the differences between communications in an existing organization compared with a new project.

  Write pseudocode of the huffman-tree construction algorithm

What is the time efficiency class of the algorithm for constructing a Huffman tree as a function of the alphabet size?

  Find maximum multiplier paths between all pairs of nodes

Consider the maximum capacity path problem defined in Exercise 4.37. Modify the Floyd-Warshall algorithm so that it finds maximum capacity paths between all pairs of nodes.

  Comparison of the different kinds of mobile

Remember to state the business problem, articulate the current setup, explain how mobile and wearable devices are different, and how they benefit the business.

  Solve the read-and-correct problem

Your pseudo code solution should provide a corrected string of characters in the order in which they were entered at the keyboard.

  Assume that you are serving in the role of director of data

imagine that you are serving in the role of director of data center operations for your company which is currently

  Define the basic law based on the facts from specific cases

This includes sub-topics discussing information privacy, privacy laws, applications and court rulings (case law is usually an extension of the basic law based on the facts from specific cases and real-world court decisions)

  Identify the make and model of one 1 laser printer and one

identify the specific manufacture and model of one 1 magnetic disk one 1 solid state drive and one 1 optical drive.

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