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

  Major difference between a hub and switch

What is the major difference between a hub and switch, which one is more efficient at routing traffic, and which is preferable in larger network configurations?

  Calculate the minimum distance from the start to the goal

Calculate the minimum distance from the start to the goal with passing all the checkpoints -Specification * A map consists of 5 characters as following.

  Describe emotional intelligence

Describe people skills that are necessary for negotiation and conflict resolution.

  Flowchart, psuedocode and desk check

Flowchart, psuedocode and desk check

  Rewrite code especially for each type of hardware platform

Portability is the ability of software to move easily from one hardware platform to another. UNIX was the first portable operating system, allowing programs to compile on multiple hardware platforms without the need for the programmer to rewrite code..

  Developing the subnet calculator using visual studio

Create a Visual Basic .NET Windows Application with the following user requirements:

  Subroutine memcpy for copying a sequence of bytes

However, in the case where the to address falls within the sequence of bytes to be copied, i.e., when the to address is between from and from+length-1, the subroutine must copy the bytes in the order of decreasing addresses by starting at the end ..

  Determining the mobile communication technique

In a congested city which of the following mobile communication technique would you use?

  Which security protocols are used to protect e-mail

Which kind of attack on cryptosystems involves using a collection of pre-identified terms? Which kind of attack involves sequential guessing of all possible key combinations?

  Describe the project testing or testing plan

Summarize your implementation and testing or develop a model, simulation, prototype, or proof of concept as an alternative to developing a fully implemented project

  Resolve using an entity or an associative entity

Give an example of many-to-many relationship. Resolve using an entity or an associative entity. Which did you use? Why?

  Html page with javascript using if statement

The game of "23" is a two-player (computer versus player) game that begins with a row of 23 toothpicks. Players take turns, withdrawing 1, 2 or 3 toothpicks at a time. The player to withdraw the last toothpick loses the game.

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