Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

We will be recreating the simple hand game, “Rock, Paper, Scissors”. Once the us

ID: 664527 • Letter: W

Question

We will be recreating the simple hand game, “Rock, Paper, Scissors”. Once the user runs the program, they will have a choice of playing with 1 or 2 players. If the user selects 1 player, the computer will play against them, and if the user selects 2 players, there will be a chance for 2 people to enter their selections.

The game will play for 3 rounds and after that it complete, it will print out the scores of the players (or player and computer) and say who won the game.

Here is what a sample output would look like:

Welcome to ROCK, PAPER, SCISSORS!!!

Are you going to play with 1 or 2 players?

2

-- Round 1 --

Player 1, what is your move? Rock

Player 2, what is your move? scissors

Player 1 wins this round!

-- Round 2 --

Player 1, what is your move? rrock

Sorry, that is not a legal move.

Player 1, what is your move? rock

Player 2, what is your move? Paper

Player 2 wins this round!

-- Round 3 --

Player 1, what is your move? paper

Player 2, what is your move? Scissors

Player 2 wins this round!

-- Game Over --

Player 1 has 1 point

Player 2 has 2 points

Player 2 wins!!!

Play again? (yes or no?)

Yes

Are you going to play with 1 or 2 players?

1

-- Round 1 --

Player 1, what is your move? Paper

Computer’s move is: scissors

Computer wins this round!

##ALSO INCLUDE SITUATIONS OF TIE

Explanation / Answer

import java.util.Scanner; /** * Tic-Tac-Toe: Two-player console, non-graphics, non-OO version. * All variables/methods are declared as static (belong to the class) * in the non-OO version. */ public class TTTConsoleNonOO2P { // Name-constants to represent the seeds and cell contents public static final int EMPTY = 0; public static final int CROSS = 1; public static final int NOUGHT = 2; // Name-constants to represent the various states of the game public static final int PLAYING = 0; public static final int DRAW = 1; public static final int CROSS_WON = 2; public static final int NOUGHT_WON = 3; // The game board and the game status public static final int ROWS = 3, COLS = 3; // number of rows and columns public static int[][] board = new int[ROWS][COLS]; // game board in 2D array // containing (EMPTY, CROSS, NOUGHT) public static int currentState; // the current state of the game // (PLAYING, DRAW, CROSS_WON, NOUGHT_WON) public static int currentPlayer; // the current player (CROSS or NOUGHT) public static int currntRow, currentCol; // current seed's row and column public static Scanner in = new Scanner(System.in); // the input Scanner

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote