class RockPaperScissors
- This class is designed to represent the game of Rock, Paper, Scissors. The game will be represented as an array of
String
, where each array index represents one of the three possible moves.
Instance variables
String[] moves
: an array that represent the possible moves
boolean isGameOver
: represents whether the game has been won
Constructors
public RockPaperScissors()
:
Methods
public String toString()
- Prints the array of possible moves
public boolean isValidMove(int p0, int p1)
:
- Returns true if both player's moves are valid indexes into the moves array, and false otherwise.
p0
index of player 0's move
p1
index of player 1's move
public void makeMove(int p0, int p1)
:
- Prints the specified moves (without checking the legality), and a message if it's a tie.
p0
index of player 0's move
p1
index of player 1's move
public boolean isGameOver()
:
- Returns true if the game is over.