Rocks, Paper Scissors game I wrote a Rock Paper Scissors game and was hoping to get some feedback on issues like:


Am I utilizing object oriented techniques correctly?  What can I do better?
Am I using main() correctly?  My understanding is that it should be a main controller for the rest of the program.  Should I be utilizing a counter in a different method, instead of in main?  
Am I using my instance variables correctly?
I realize that the computer choice is skewed.  How should I do it differently?
The way I check for wins seems a little convoluted.  Should I be using a different system to check?
What did I do well, so that I can remember to use those techniques?  What did I do poorly?


Main

import java.util.*;
public class driver {



public static void main(String[] args) {

    int userWins = 0, computerWins = 0;

    System.out.println("Welcome to Rocks, Paper, Scissors. How many games would you like to play?");
    Scanner in = new Scanner(System.in);
    int numberOfGames = in.nextInt();
    int userCounter = 0;
    int computerCounter = 0;
    for (int i = 0; i &lt; numberOfGames; i++) {
        RPS Game = new RPS();
        String user = Game.startGame();
        String computer = Game.computerChoice();
        boolean wins = Game.evaluateGame(user, computer);
        if (wins == true){
            userWins++;
        }
        else {
            computerWins++;
        }
        System.out.println("Number of wins:");
        System.out.println("Computer: " + computerWins);
        System.out.println("User: " + userWins);
        System.out.println();
    }
  }
}


RPS

import java.util.Scanner;

public class RPS {
    String comparableChoice;
    String userComparableChoice;


        public String startGame() {
        Scanner in = new Scanner(System.in);
        System.out.println("Choose, (1)Rock, (2)Paper or (3)Scissors");
        System.out.println("enter number: 1,2 or 3");
        int userChoice = in.nextInt();

        if (userChoice == 1){
            System.out.println("Your choice: Rock");
            userComparableChoice = "Rock";
        }
        else if (userChoice == 2){
            System.out.println("Your choice: Paper");
            userComparableChoice = "Paper";
        }
        else{
            System.out.println("Your choice: Scissors");
            userComparableChoice = "Scissors";
        }
        return userComparableChoice;
    }

    public String computerChoice(){
        int computerChoiceNumber = (int)(Math.random() * 10);
        if (computerChoiceNumber &lt;= 3){
            System.out.println("Computer choice: Rock");
            comparableChoice = "Rock";
        }
        else if (computerChoiceNumber &lt;= 6){
            System.out.println("Computer choice: Paper");
            comparableChoice = "Paper";
        }
        else{
            System.out.println("Computer choice: Scissors");
            comparableChoice = "Scissors";
        }
        return comparableChoice;
    }

    public boolean evaluateGame(String userFormal, String computerFormal){

        if (userFormal.equals(computerFormal)){
            System.out.println("It's a tie");

        }
        if (userFormal.equalsIgnoreCase("Rock") &amp;&amp; computerFormal.equalsIgnoreCase("Scissors")){
            System.out.println("You won!");
            return true;
        }
        if (userFormal.equalsIgnoreCase("Paper") &amp;&amp; computerFormal.equalsIgnoreCase("Rock")){
            System.out.println("You won");
            return true;
        }
        if (userFormal.equalsIgnoreCase("Scissors") &amp;&amp; computerFormal.equalsIgnoreCase("Paper")){
            System.out.println("You won");
            return true;
        }
        else {
            System.out.println("Computer won");
            return false;
        }

    }

}
I would only call the method startGame() inside the main function and handle from there the entire logic of the game. The main method shouldn't be aware of the exact procedure of a game. It just wants to start a game and wants to know who won. As an output from that method you could return true if the user wins and false if the computer wins. If you want to handle a tie separately you can return an int value instead for indicating the outcome (-1 computer wins, 0 draw, 1 user wins).

Inside the startGame() method you can call the game logic functions/your algorithm. In pseudo code it would look sth like this:

public int startGame()
{
    userChoice();
    computerChoice();
    return evaluateWinner(); // Evaluate winner and returns -1, 0, 1 depending on the user and computer choice (i.e. who the winner is or if its a tie)
}


You can make the other methods of the RPS class private to have a clean interface for this class, allowing other classes only to start a game and prevent them interfering the game algorithm itself.