Write program that play rock-paper-scissors-lizardspock game

Assignment Help JAVA Programming
Reference no: EM131082071

Write a program that plays the Rock-Paper-Scissors-Lizard-Spock game. Refer to https://en.wikipedia.org/wiki/Rock-paper-scissors-lizard-Spock for more information.

Normally, one player is a human and the other is the computer program. However, in this exercise, the program will generate two players who play against each other. The play continues until either of the computer-generated players wins four consecutive times.

In this game, two random integers are generated in the range of [1 to 5], one per player. 1 refers to Rock, 2 refers to Paper, 3 refers to Scissors, 4 refers to Lizard, and 5 refers to Spock.

For example, if the computer randomly generates integers 2 and 5 in the first iteration, 2 is for the first player and 5 is for the second player. Based on Rule 8 in the following 10 rules, Paper (2) disproves Spock (5), so Player 1 wins. Repeat it to generate one more pair and determine who wins that iteration. Continue the iterations until one player wins four consecutive times.

Rule 1: Scissors cut paper
Rule 2: Paper covers rock
Rule 3: Rock crushes lizard
Rule 4: Lizard poisons Spock
Rule 5: Spock smashes (or melts) scissors
Rule 6: Scissors decapitate lizard
Rule 7: Lizard eats paper
Rule 8: Paper disproves Spock
Rule 9: Spock vaporizes rock
Rule 10: Rock breaks scissors

RockPaperScissorsLizardSpck

Attributes

+ private int consecutiveWins
+ private int lastWinner
+ public static final int LIZARD
+ public static final int PAPER
+ public static final int PLAYER1
+ public static final int PLAYER2
+ public static final int ROCK
+ public static final int SCISSORS
+ public static final int SPOCK

- Operations

+ public int getConsecutiveWins()
+ public int getLastWinner()
+ public int random()
+ public static String convert(int i)
+ public void play(int player1, int player2)

Reference no: EM131082071

Questions Cloud

Licensing proprietary technology to foreign competitors : Licensing proprietary technology to foreign competitors is the best way to give up a firm's competitive advantage. Discuss whether you agree or disagree with this statement.
Pricing strategy would these firms consider : Two competing soft-drinks firm Cepsi and Poke are entering a new market where neither has been sold before. What type of LR pricing strategy would these firms consider?
What is minimum income necessary to achieve total utility : A consumer has preferences for apples (A) and Oranges (Or) given by the utility function U(A,Or) = log(A) / 2 + log(Or) where log() is the natural logarithm function. The Marginal Utility for A is 1/2A and the marginal utility for Or is 1/Or.  What i..
Discussing authentic leadership : "The Empty Carriage: Lessons in Leadership from Florence Nightingale" why this article is relevant today when discussing Authentic Leadership?
Write program that play rock-paper-scissors-lizardspock game : Write a program that plays the Rock-Paper-Scissors-Lizard-Spock game. Refer to http://en.wikipedia.org/wiki/Rock-paper-scissors-lizard-Spock for more information.
What are transfer payments : What are transfer payments, and how do they make their way into the GDP calculation? If one added up the value of all intermediate goods that went into the production of real GDP, the total value of intermediate goods would be
Find an equation describing the plane passing through point : Quiz 2. Find an equation describing the plane passing through the point (1, -1, -1) and parallel to the plane 5x - y - z = 6
Differences in scientific judgment between economists : Differences in scientific judgment between economists are similar to all of the following except
Many economists specializing in growth theory : Many economists specializing in "growth theory" contend that developing countries may achieve strong economic growth by increasing the amount of capital and labor available for production, but that this type of growth strategy is incapable of support..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create an abstract class named element

Part 1: Create an abstract class named Element that holds properties of elements, including their symbol, atomic number, and atomic weight. Include a constructor that requires values for all three properties and a get method for each value.

  What constructor overloading in java

Define what constructors are, what constructor overloading in Java is and also what is a copy constructor.

  Create java applet to represent grade of gas

Write a java applet (not a java application program) for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use.

  Binary value and the hexadecimal value

Write a program that will read in a binary number (base 2) and a hexadecimal value (base 16). Your program then calculates and shows the equivalent decimal values for both the binary value and the hexadecimal value.

  User interface menu using doubly linked lists

Each mNode defines the main menu item name, two links to its mNode neighbors (the previous and next mNode) and a link to its first submenu node.

  Java shape program console

Program is adequately documented. It's comments identifies its name, purpose, author and date. Throughout the code, comments and/or relevant component names should attempt to make the program understandable.

  A fault is fundamentally a deviation from expected behavior

write a 200- to 300-word short-answer response to the following a fault is basically a deviation from expected

  Develop a reservation system program for specific flights.

develop a reservation system program for specific flights. A customer should be able to select from one of four categories of seats on flights from RDU to any of at least three other destinations. Based on the user input of seat type and destination,..

  Multi-threaded programming in java using locks

Assignment on Multi-threaded Programming in Java Using Locks

  Design a function named "falling distance"

Design a function named "fallingDistance" that accepts an objects falling time, in seconds, as an argument. The function should return the distance, in meters, that the object has fallen during that time interval. Design a program that calls the func..

  Negatively impacting health care currently

Identify and explain at least two events that are negatively impacting health care currently. Tell us why you think these items are negatively impacting the access to care, and make sure that you cite your references.

  Develop a test plan for testing the bankloan class

Create a class named BankLoan which will represent information about a loan a person wants to get from the bank, to purchase a car, a house, or some other expensive item, and they will pay back gradually over time.

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