package com.github.javaccsf2016.rockpaperscissorsgame;

import java.util.Random;

public class RPSGame {
	public static final int ROCK = 0;
	public static final int PAPER = 1;
	public static final int SCISSOR = 2;
	
	private int numberOfTies;
	private int numberOfWins;
	private int numberOfLoses;
	private int move;
	
	public RPSGame() {
		numberOfTies = 0;
		numberOfWins = 0;
		numberOfLoses = 0;
	}
	
	public void generateComputerPlay() {
		Random rand = new Random();
		this.move = rand.nextInt(3);
	}
	
	public int findWinner(int userMove) {
		if (userMove >= 0 && userMove <= 2) {
			if (userMove == this.move) {
				this.numberOfTies++;
				return 1;
			} else if(userMove - this.move == 1 || userMove - this.move == -2) {
				this.numberOfWins++;
				return 2;
			} else {
				this.numberOfLoses++;
				return 0;
			} 
		} else {
			return -1;
		}
	}

	public int getLoses() {
		return this.numberOfLoses;
	}

	public int getWins() {
		return this.numberOfWins;
	}

	public int getTies() {
		return this.numberOfTies;
	}
	
}

@@ -209,16 +209,121 @@
  = 2;%0A%09%0A
+%09public static final int LOSE = 0;%0A%09public static final int TIE = 1;%0A%09public static final int WIN = 2;%0A%09%0A
 %09private
@@ -337,24 +337,24 @@
 mberOfTies;%0A
-
 %09private int
@@ -664,17 +664,20 @@
 Move %3E= 
-0
+ROCK
  && user
@@ -684,17 +684,23 @@
 Move %3C= 
-2
+SCISSOR
 ) %7B%0A%09%09%09i
@@ -763,17 +763,19 @@
 %09return 
-1
+TIE
 ;%0A%09%09%09%7D e
@@ -876,17 +876,19 @@
 %09return 
-2
+WIN
 ;%0A%09%09%09%7D e
@@ -930,17 +930,20 @@
 %09return 
-0
+LOSE
 ;%0A%09%09%09%7D %0A

use constant for readability