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

  Write java application to demonstrate the behavior

The source code is patterned after a similar example that was taken from Joyce Farrell's textbook, Java Programming.

  Using joptionpanes to handle your input and output

Using JOptionPanes to handle your input and output, produce a Java program which, given three sides of a triangle, determines whether the triangle is.

  Program that computes and prints the value of 6!/5! using

Write a Java program that computes and prints the  value of 6!/5! using Scanner.

  Describe the basic c syntax for creating a class comprise

explain the basic c syntax for creating a class. include an explanation of the private and public section of a class

  Write a java program to read the numbers from the disk file

Write a Java program to read the numbers from the disk file and store them in an integer array ( not an ArrayList ).

  Find a java application on the web and describe it

What functionality does the application have that you have learned about in this class?

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Explain gui technique message dialog box

Write an application called Circle.java that inputs from the user the radius of a circle as an integer and prints the circle's diameter, circumference, and area. Use the example program and GUI technique message dialog box shown in the Week 1 Lect..

  A class is a blueprint for an object

A class is a blueprint for an object. A class may have a default constructor, a constructor with arguments, accessor methods, mutator methods, public fields, and private fields.

  Write a gui program that maintains a set of contacts

Write a GUI program that maintains a set of contacts. Each contact has name, address, and a list of phone numbers. This contacts should be be stored in a HashMap

  What are the main differences between javabeans and applets

What are the main differences between JavaBeans and applets? How do I use an applet that resides on a remote machine?

  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..

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