Paper rock scissors java program.
Ok so the only problem I'm having now is the player's score doesn't update until the second loop around. Any suggestions?
Thanks again Radiodef for your help!!
Updated code below.......
import java.util.Scanner;
public class RPS_Game {
public static void main(String[] args) {
char r = 'R';
char p = 'P';
char s = 'S';
char player1 = 0;
char player2 = 0;
int player1Score = 0;
int player2Score = 0;
int playCount = 0;
Scanner scan = new Scanner(System.in);
while(playCount < 3) {
System.out.print("Please enter either (R)ock, (P)aper, or (S)iccors: ");
player1 = scan.nextLine().toUpperCase().charAt(0);
System.out.print("Please enter either (R)ock, (P)aper, or (S)iccors: ");
player2 = scan.nextLine().toUpperCase().charAt(0);
int winner = winningPlayer(player1, player2);
if(winner == 0) {
System.out.print("\nIt's a tie. Nobody wins!\n");
System.out.println("\nPlayer 1: " + (player1Score += 0));
System.out.println("\nPlayer 2: " + (player2Score += 0));
}
if(winner == 1) {
System.out.print("\nPlayer 1 wins!!\n");
System.out.println("\nPlayer 1: " + player1Score++);
System.out.println("\nPlayer 2: " + (player2Score += 0));
}
if(winner == 2) {
System.out.print("\nPlayer 2 wins!!\n");
System.out.println("\nPlayer 1: " + (player1Score += 0));
System.out.println("\nPlayer 2: " + player2Score++);
}
playCount++;
}
}
public static int winningPlayer(int player1, int player2) {
//Player 1 wins
int result = 0;
if(player1 == 'R' && player2 == 'S') {
result = 1;
}
else if(player1 == 'P' && player2 == 'R') {
result = 1;
}
else if(player1 == 'S' && player2 == 'P') {
result = 1;
}
//Player 2 wins
else if(player2 == 'R' && player1 == 'S') {
result = 2;
}
else if(player2 == 'P' && player1 == 'R') {
result = 2;
}
else if(player2 == 'S' && player1 == 'P') {
result = 2;
}
return result;
}
}
Well, it seems like first you just need to move the call in to the loop:
while(playCount < 3) {
System.out.print("Please enter either (R)ock, (P)aper, or (S)iccors: ");
player1 = scan.nextLine().toUpperCase().charAt(0);
System.out.print("Please enter either (R)ock, (P)aper, or (S)iccors: ");
player2 = scan.nextLine().toUpperCase().charAt(0);
// recompute the winner each time
int winner = winningPlayer(player1, player2);
...
}
For keeping a score, you could just have a variable for each player:
int player1Score = 0;
int player2Score = 0;
while (...) {
...
if (winner == 1) {
++player1Score;
}
if (winner == 2) {
++player2Score;
}
}
Or you could do something fancier like use an array:
int[] scores = new int[3];
while (...) {
...
++scores[ winner ];
for (int i = 1; i < scores.length; ++i) {
System.out.printf("Player %d score is %d.\n", i, scores[i]);
}
}
Related
I have been trying to figure out how to write the code to reset my program/ clear the board so tic tac toe can be played again. It is supposed to have a prompt that asks "do you want to play again" after a win/tie. It's the final part I am trying to figure out.
Board:
public class Board {
private char[][] board;
public Board() {
char[][] temp = {{'1', '2', '3'}, {'4', '5', '6'}, {'7', '8', '9'}};
board = temp;
}
public void printBoard() {
for (char[] row : board) {
for (char cell : row) {
System.out.printf("| %c ", cell);
}
System.out.println();
}
}
public boolean isCellAvailable(int number) {
if (1 <= number && number <= 9) {
int row = (number - 1) / 3;
int col = (number - 1) % 3;
if (board[row][col] == 'X' || board[row][col] == 'O') return false;
else return true;
}
return false;
}
public void place(int number, char marker) {
int row = (number - 1) / 3;
int col = (number - 1) % 3;
board[row][col] = marker;
}
public boolean isWinner() {
if (board[0][0] == board[0][1] && board[0][1] == board[0][2]) return true;
else if (board[1][0] == board[1][1] && board[1][1] == board[1][2]) return true;
else if (board[2][0] == board[2][1] && board[2][1] == board[2][2]) return true;
else if (board[0][0] == board[1][0] && board[1][0] == board[2][0]) return true;
else if (board[0][1] == board[1][1] && board[1][1] == board[2][1]) return true;
else if (board[0][2] == board[1][2] && board[1][2] == board[2][2]) return true;
else if (board[0][0] == board[1][1] && board[1][1] == board[2][2]) return true;
else if (board[0][2] == board[1][1] && board[1][1] == board[2][0]) return true;
return false;
}
}
Driver:
import java.util.Scanner;
class Driver {
public static void main(String[] args) {
Board board = new Board();
Scanner scanner = new Scanner(System.in);
board.printBoard();
int moves = 0;
while (true) {
while (true) {
System.out.print("Player 1: Enter your move: ");
int cell = scanner.nextInt();
if (board.isCellAvailable(cell)) {
board.place(cell, 'X');
board.printBoard();
moves += 1;
break;
} else {
System.out.println("Cell not available.");
}
}
if (board.isWinner()) {
System.out.println("Player 1 wins.");
break;
}
if (moves == 9) {
System.out.println("Draw. Game ended.");
break;
}
while (true) {
System.out.print("Player 2: Enter your move: ");
int cell = scanner.nextInt();
if (board.isCellAvailable(cell)) {
board.place(cell, 'O');
board.printBoard();
moves += 1;
break;
} else {
System.out.println("Cell not available.");
}
}
if (board.isWinner()) {
System.out.println("Player 2 wins.");
break;
}
}
}
}
You need another loop in order to manage the Play again option. If the player wants to play again, a new Board() is created and the moves are reseted as well. Something like this:
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (true) {
Board board = new Board();
board.printBoard();
int moves = 0;
while(true){
while (true) {
System.out.print("Player 1: Enter your move: ");
int cell = scanner.nextInt();
if (board.isCellAvailable(cell)) {
board.place(cell, 'X');
board.printBoard();
moves += 1;
break;
} else {
System.out.println("Cell not available.");
}
}
if (board.isWinner()) {
System.out.println("Player 1 wins.");
break;
}
if (moves == 9) {
System.out.println("Draw. Game ended.");
break;
}
while (true) {
System.out.print("Player 2: Enter your move: ");
int cell = scanner.nextInt();
if (board.isCellAvailable(cell)) {
board.place(cell, 'O');
board.printBoard();
moves += 1;
break;
} else {
System.out.println("Cell not available.");
}
}
if (board.isWinner()) {
System.out.println("Player 2 wins.");
break;
}
}
System.out.println("Do you want to play again? Press 1, otherwise press 0")
int option = scanner.nextInt();
if(option == 0) break;
}
}
This question already has answers here:
How do I compare strings in Java?
(23 answers)
Closed 4 years ago.
Thats my tictactoe game and i have this problem i cant find out...When i compile my programm
Welcome To Tic Tac Toe Professor Falken!
***Use Numbers 1-9 To Select A Square***
_1_|_2_|_3_|
_4_|_5_|_6_|
_7_|_8_|_9_|
You Go First!
___|___|___|
___|___|___|
___|___|___|
Player X, enter move (1 - 9):
10
INVALID MOVE: Enter number 1 - 9 only:
5
___|___|___|
___|_X_|___|
___|___|___|
Player O, enter move (1 - 9):
___|___|___|
___|_X_|_O_|
___|___|___|
Player X, enter move (1 - 9):
4
___|___|___|
_X_|_X_|_O_|
___|___|___|
Player O, enter move (1 - 9):
And stops there, i dont know why can anyone help me?
import java.util.Random;
import java.util.Scanner;
public class TicTacToe {
private Scanner in;
private boardPiece[][] board = {{new boardPiece(),new boardPiece(),new boardPiece()},
{new boardPiece(),new boardPiece(),new boardPiece()},
{new boardPiece(),new boardPiece(),new boardPiece()}};
private char turn = 'X';
private boolean win = false;
private int count = 0;
private Random random = new Random();
private int randomNumber = random.nextInt(9);
public static void main(String [] args)
{
int replay;
TicTacToe game = new TicTacToe();
game.in = new Scanner(System.in);
System.out.println("Welcome To Tic Tac Toe Professor Falken!");
System.out.println("***Use Numbers 1-9 To Select A Square***");
System.out.println("_1_|_2_|_3_|");
System.out.println("_4_|_5_|_6_|");
System.out.println("_7_|_8_|_9_|");
System.out.println(" n You Go First!");
game.play();
System.out.println("Would you like to play again?(1 = Yes & 2 = No): ");
replay = game.in.nextInt();
while(replay != 2){
game.init();
game.play();
System.out.println("Would you like to play again?(1 = Yes & 2 = No): ");
replay = game.in.nextInt();
}
game.in.close();
System.out.println("How about a nice game of chess :p");
}
public void play()
{
printBoard();
while(!win)
move();
}
public void printBoard()
{
for(int x=0; x<3; x++){
for(int y=0; y<3; y++){
System.out.print(board[x][y].piece);
}
System.out.println();
}
}
public void move()
{
int move = 0;
String valid = "";
System.out.println("Player " + turn + ", enter move (1 - 9): ");
if(turn == 'O') {
move = randomNumber; }
else {
move = in.nextInt();
}
valid = checkMove(move);
while(valid != "ok")
{
if(turn == 'X') {
System.out.println("INVALID MOVE: "+ valid);
move = in.nextInt();
}
else {
move = randomNumber;
}
valid = checkMove(move);
}
count++;
board[(move-1)/3][(move-1)%3].piece = "_"+turn+"_|";
board[(move-1)/3][(move-1)%3].player = turn;
board[(move-1)/3][(move-1)%3].used = true;
printBoard();
if(count >= 5)
checkWin(move);
if(turn == 'X')
turn = 'O';
else
turn = 'X';
}
public String checkMove(int move)
{
if(move < 1 || move > 9)
return "Enter number 1 - 9 only: ";
else
if(board[(move-1)/3][(move-1)%3].used)
return "That move has been used. Enter another move (1 - 9): ";
else
return "ok";
}
public void checkWin(int move)
{
for(int x = 0; x<3; x++){ //Horizontal
if((board[x][0].used && board[x][1].used && board[x][2].used) &&
(board[x][0].player == board[x][1].player && board[x][0].player == board[x][2].player)){
System.out.println("Congratulations Player " + turn + "!!! You win!");
win = true;
return;
}
}
for(int y = 0; y<3; y++)
{
if((board[0][y].used && board[1][y].used && board[2][y].used) &&
(board[0][y].player == board[1][y].player && board[0][y].player == board[2][y].player)){
System.out.println("Congratulations Player " + turn + "!!! You win!");
win = true;
return;
}
}
if((board[0][0].used && board[1][1].used && board[2][2].used) &&
(board[0][0].player == board[1][1].player && board[0][0].player == board[2][2].player)){
System.out.println("Congratulations Player " + turn + "!!! You win!");
win = true;
return;
}
if((board[2][0].used && board[1][1].used && board[0][2].used) &&
(board[2][0].player == board[1][1].player && board[2][0].player == board[0][2].player))
{
System.out.println("Congratulations Player " + turn + "!!! You win!");
win = true;
return;
}
if(count==9){
System.out.println("Draw! Nobody Wins (´???`)");
win = true;
return;
}
}
public void init()
{
for(int x=0;x<3;x++){
for(int y=0;y<3;y++){
board[x][y] = new boardPiece();
}
}
turn = 'X';
win = false;
count = 0;
}
class boardPiece{
public String piece;
public char player;
public boolean used;
boardPiece(){
piece = "___|";
used = false;
}
}
}
I made a some changes in move and checkMove
public void move() {
int move = 0;
Boolean valid = false;
System.out.println("Player " + turn + ", enter move (1 - 9): ");
if (turn == 'O') {
move = randomNumber;
} else {
move = in.nextInt();
}
valid = checkMove(move);
while (!valid) {
if (turn == 'X') {
move = in.nextInt();
} else {
move = random.nextInt(9);
}
valid = checkMove(move);
}
count++;
board[(move - 1) / 3][(move - 1) % 3].piece = "_" + turn + "_|";
board[(move - 1) / 3][(move - 1) % 3].player = turn;
board[(move - 1) / 3][(move - 1) % 3].used = true;
printBoard();
if (count >= 5) {
checkWin(move);
}
if (turn == 'X') {
turn = 'O';
}else {
turn = 'X';
}
}
public Boolean checkMove(int move) {
if (move < 1 || move > 9) {
System.out.println("INVALID MOVE: Enter number 1 - 9 only: ");
return false;
}else if (board[(move - 1) / 3][(move - 1) % 3].used) {
System.out.println("INVALID MOVE: That move has been used. Enter another move (1 - 9): ");
return false;
}else {
return true;
}
}
Hey guys so I'm taking my first Java class ever and am stuck with an error code while trying to compile this program. I attached both classes hoping somewhere he can help me find the error. This is the error I'm receiving:
Error: constructor Card in class Card cannot be applied to given types;
required: char,char
found: no arguments
reason: actual and formal argument lists differ in length
It shows the error is on the line "Card temp= new Card();" under the public void shuffle method. Any help will be greatly appreciated.
import java.util.Random;
import java.util.Scanner;
public class Deck {
private Card [] data;
public Deck()
{
String suits = "HDSC";
String ranks = "A23456789TJQK";
data = new Card[52];
int count = 0;
Card C1;
for (int s = 0; s < suits.length(); s++){
for (int r = 0; r < ranks.length(); r ++)
{
C1 = new Card(ranks.charAt(r), suits.charAt(s));
data[count++] = C1;
}
}
}
//This function display's the whole deck of cards
// Our output should be as below
// AH 2H 3H ... KH
// AS 2H 3S ... KS
// AD 2D 3D ... KD
// AC 2C 3C ... KC
public void display()
{
int index=1;
for (int i=0; i<52; i++)
{
System.out.print(data[i].rank +"" + data[i].suit + " ");
if (index%13 == 0 && i!=0 )
System.out.println();
index++;
}
}
//This function randomly shuffles the deck of cards
public void shuffle()
{
int index;
Random random = new Random();
for (int i = 0; i<52; i++)
{
index = i + random.nextInt(52 - i);
Card temp= new Card();
if (index != i)
{
temp = data[i];
data[i] = data[index];
data[index] = temp;
}
}
System.out.println("Card Shuffled");
}
public void deal()
{
int sum = 0;
int countPrime = 0;
boolean isPrime = false;
for(int i=0; i<52; i++)
{
sum += data[i].getValue(data[i]);
isPrime = checkPrime(sum);
if (isPrime == true)
{
sum = 0;
countPrime++;
if (i==51)
{
System.out.println("Winner in " + countPrime + " Piles");
break;
}
}
if (i==51)
System.out.println("Loser");
}
}
boolean checkPrime(int num)
{
boolean isPrime = true;
for(int j = 2; j <= num/2; ++j)
{
// condition for nonprime number
if(num % j == 0)
{
isPrime = false;
break;
}
}
return isPrime;
}
//Display menu
public static int menu() {
System.out.println("\nWelcome to Solitaire Prime!");
System.out.println("1) New Deck");
System.out.println("2) Display Deck");
System.out.println("3) Shuffle Deck");
System.out.println("4) Play Solitaire Prime");
System.out.println("5) Exit");
Scanner in=new Scanner(System.in);
int choice = in.nextInt();
return choice;
}
public static void main(String args[])
{
Deck newDeck = null;
int choice;
do{
//Accepts user input for menu
choice = menu();
if (choice == 1)
{
newDeck = new Deck();
System.out.println("New deck created");
}
else if (choice == 2 )
{
newDeck.display();
}
else if (choice == 3 )
{
newDeck.shuffle();
}
else if (choice == 4 )
{
newDeck.shuffle();
newDeck.deal();
}
else if (choice == 5)
{
System.out.println("Exiting game. Goodbye!");
return;
}
else
System.out.println("Wrong choice! Please try again.");
}while(choice!=5);
}
}
public class Card {
char suit;
char rank;
public Card(char r, char s)
{
rank = r;
suit = s;
}
public void menu()
{
}
public void display(Card C1)
{
char suit = getSuit(C1);
char rank = getRank(C1);
String suitName = "";
String rankName = "";
if (suit == 'S')
suitName = "Spade";
else if (suit == 'H')
suitName = "Hearts";
else if (suit == 'C')
suitName = "Clubs";
else if (suit == 'D')
suitName = "Diamonds";
if (rank == 'A')
rankName = "Ace";
else if (rank == '2')
rankName = "Two";
else if (rank == '3')
rankName = "Three";
else if (rank == '4')
rankName = "Four";
else if (rank == '5')
rankName = "Five";
else if (rank == '6')
rankName = "Six";
else if (rank == '7')
rankName = "Seven";
else if (rank == '8')
rankName = "Eight";
else if (rank == '9')
rankName = "Nine";
else if (rank == '1')
rankName = "Ten";
else if (rank == 'J')
rankName = "Jack";
else if (rank == 'Q')
rankName = "Queen";
else if (rank == 'K')
rankName = "King";
System.out.println(rankName + " of " + suitName);
}
//This method gives the value of a card
public int getValue(Card C1)
{
int value = 0;
if (C1.rank == 'A')
value = 1;
else if (C1.rank == '2')
value = 2;
else if (C1.rank == '3')
value = 3;
else if (C1.rank == '4')
value = 4;
else if (C1.rank == '5')
value = 5;
else if (C1.rank == '6')
value = 6;
else if (C1.rank == '7')
value = 7;
else if (C1.rank == '8')
value = 8;
else if (C1.rank == '9')
value = 9;
else if (C1.rank == '1')
value = 10;
else if (C1.rank == 'J')
value = 10;
else if (C1.rank == 'Q')
value = 10;
else if (C1.rank == 'K')
value = 10;
return value;
}
//This method gives the rank of a card
public char getRank(Card C1)
{
return C1.rank;
}
//This method gives the suit of a card
public char getSuit(Card C1)
{
return C1.suit;
}
}
Your Card class only has a constructor that takes two char arguments; there is no zero-argument constructor defined.
When shuffling, you don't need to create a new instance of Card like you're currently doing here: Card temp= new Card(); Instead of creating a new instance of Card and throwing it away, just assign the shuffled Card value to your temp variable like this:
for (int i = 0; i<52; i++)
{
index = i + random.nextInt(52 - i);
if (index != i)
{
Card temp = data[i];
data[i] = data[index];
data[index] = temp;
}
}
Note that we moved temp into the if-block, since it's only used in that scope.
I am working on a ROCK PAPER SCISSORS project for class and am trying to use a method which prints who wins the match and also return a value I'm using to determine who has the most wins.
However in the first method when I assign the method to a value to use it it prints out the statements in the evaluate method, is there any way around this or will I have to create another method that does the same thing just with out the print statements?
(userWins and computerWins are declared and initialized in main() )
main( ) {
int userWins = 0;
int computerWins = 0;
.....
int value = winEvaluation(userChoice, computerChoice);
if (value == 1){
userWins++;
} else if (value == 2){
computerWins++;
} else{
}
System.out.prinln("user wins: " + userWins + " computer wins: " + computerWins);
}
private static int evaluate(int userChoice, int computerChoice) {
int winValue = 0;
String win = "You win.";
String lose = "I win.";
String draw = "We picked the same thing! This round is a draw.";
if( userChoice == 1) {
if(computerChoice == 1){
System.out.println(draw);
winValue = 0;
}else if(computerChoice == 2){
System.out.print("PAPER covers ROCK." );
System.out.println(lose);
winValue = 2;
}else {
System.out.print("ROCK breaks SCISSORS.");
System.out.println(win);
winValue = 1;
}
}else if (userChoice == 2 ) {
if (computerChoice == 1){
System.out.print("PAPER covers ROCK.");
System.out.println(win);
winValue = 1;
}else if (computerChoice == 2){
System.out.println(draw);
winValue = 0;
}else {
System.out.print("SCISSORS cuts PAPER.");
System.out.println(lose);
winValue = 2;
}
}else if (userChoice == 3){
if (computerChoice == 1){
System.out.print("ROCK breaks SCISSORS.");
System.out.println(lose);
winValue = 2;
}else if (computerChoice == 2){
System.out.print("SCISSORS cuts PAPER.");
System.out.println(win);
winValue = 1;
}else {
System.out.println(draw);
winValue = 0;
}
}
return winValue;
}
So im making everyone's fun game "Rock, Paper, Scissors" I got everything working, except having the while loop repeat 3 time before stopping. Well it does repeat 3 times and stops, but the 2nd and 3rd repeat the variables don't change. Take a look at the code and tell me what I'm doing wrong.
**UPDATE: Now that I have everything working how do I get this "Q" string to terminate the loop?
import java.util.Scanner;
import java.util.Random;
public class RockPaperScissors
{
/**
* (Insert a brief description that describes the purpose of this method)
*
* #param args
*/
public static void main(String[] args)
{
int compint;
String usermove = "";
String compmove = "";
String winner = "";
int count = 0;
Scanner in = new Scanner(System.in);
Random gen = new Random();
System.out.println("Enter Rock(1), Paper(2), Scissors(3) {Q to quit]: ");
int input = in.nextInt();
while (count < 3)
{
compint = gen.nextInt(3) + 1;
if (input == 1)
{
usermove = "Rock";
}
else if (input == 2)
{
usermove = "Paper";
}
else if (input == 3)
{
usermove = "Scissors";
}
if (compint == 1)
{
compmove = "Rock";
}
else if (compint == 2)
{
compmove = "Paper";
}
else if (compint == 3)
{
compmove = "Scissors";
}
if (compint == input)
{
winner = "TIE";
}
else if (compint == 1 && input == 3)
{
winner = "COMPUTER";
}
else if (compint == 2 && input == 1)
{
winner = "COMPUTER";
}
else if (compint == 3 && input == 2)
{
winner = "COMPUTER";
}
else
{
winner = "USER";
}
System.out.print("Computer: " + compmove + " | ");
System.out.print("You: " + usermove + " | ");
System.out.println("Winner: " + winner);
System.out.println();
System.out.println("Enter Rock(1), Paper(2), Scissors(3) {Q to quit]: ");
input = in.nextInt();
count++;
}
}
}
Output:
Enter Rock(1), Paper(2), Scissors(3) {Q to quit]:
1
Computer: Scissors | You: Rock | Winner: USER
Enter Rock(1), Paper(2), Scissors(3) {Q to quit]:
2
Computer: Rock | You: Paper | Winner: USER
Enter Rock(1), Paper(2), Scissors(3) {Q to quit]:
Q
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at RockPaperScissors.main(RockPaperScissors.java:102)
The logic that actually does anything with the input – all those if statements – is outside of the loop. With each iteration through the look, none of that logic is not actually executed. It all just happens first. Try this instead:
for (int count=0; count < 3; count++)
{
int input = in.nextInt();
int compint = gen.nextInt(3) + 1;
// all the if statements and printing here
}
**UPDATE: Now that I have everything working how do I get this "Q" string to terminate the loop?
You're getting an InputMismatchException when typing Q but the code calls Scanner#nextInt(). The docs are pretty clear on what the problem is:
Thrown by a Scanner to indicate that the token retrieved does not match the pattern for the expected type, or that the token is out of range for the expected type.
It's basically the Scanner's way of telling you "you asked for an int but the next token isn't one." You can add an additional check before the nextInt() calls, using Scanner#hasNextInt(), to verify that the next token actually is an int. If it's not an int, then you can plan on parsing it just as a string.
So instead of this:
input = in.nextInt();
Do something like this:
if (in.hasNextInt())
{
input = in.nextInt();
} else if (in.hasNext("Q")) {
// quit
}
seems you wanted to use do - while loop
it would work:
do{
compint = gen.nextInt(3) + 1;
System.out.println("Enter Rock(1), Paper(2), Scissors(3) {Q to quit]: ");
int input = in.nextInt();
if (input == 1)
{
usermove = "Rock";
}
else if (input == 2)
{
usermove = "Paper";
}
else if (input == 3)
{
usermove = "Scissors";
}
if (compint == 1)
{
compmove = "Rock";
}
else if (compint == 2)
{
compmove = "Paper";
}
else if (compint == 3)
{
compmove = "Scissors";
}
if (compint == input)
{
winner = "TIE";
}
else if (compint == 1 && input == 3)
{
winner = "COMPUTER";
}
else if (compint == 2 && input == 1)
{
winner = "COMPUTER";
}
else if (compint == 3 && input == 2)
{
winner = "COMPUTER";
}
else
{
winner = "USER";
}
System.out.print("Computer: " + compmove + " | ");
System.out.print("You: " + usermove + " | ");
System.out.println("Winner: " + winner);
System.out.println("Enter Rock(1), Paper(2), Scissors(3) {Q to quit]: ");
input = in.nextInt();
count++;
}while (count < 3);