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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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