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;
	
	public static final int LOSE = 0;
	public static final int TIE = 1;
	public static final int WIN = 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 >= ROCK && userMove <= SCISSOR) {
			if (userMove == this.move) {
				this.numberOfTies++;
				return TIE;
			} else if(userMove - this.move == 1 || userMove - this.move == -2) {
				this.numberOfWins++;
				return WIN;
			} else {
				this.numberOfLoses++;
				return LOSE;
			} 
		} else {
			return -1;
		}
	}

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

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

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

@@ -314,16 +314,65 @@
  = 2;%0A%09%0A
+%09public static final int INITIAL_MONEY = 1000;%0A%09%0A
 %09private
@@ -464,16 +464,61 @@
 t move;%0A
+%09private int betMoney;%0A%09private int balance;%0A
 %09%0A%09publi
@@ -592,16 +592,43 @@
 es = 0;%0A
+%09%09balance = INITIAL_MONEY;%0A
 %09%7D%0A%09%0A%09pu
@@ -724,24 +724,218 @@
 nt(3);%0A%09%7D%0A%09%0A
+%09public boolean setBettingAmount(int money) %7B%0A%09%09if(money %3E 0 && money %3E this.balance) %7B %0A%09%09%09this.betMoney = money;%0A%09%09%09this.balance -= money;%0A%09%09%09return true;%0A%09%09%7D else %7B%0A%09%09%09return false;%0A%09%09%7D%0A%09%7D%0A%09%0A
 %09public int 
@@ -1063,24 +1063,72 @@
 erOfTies++;%0A
+%09%09%09%09this.balance += betMoney;%0A%09%09%09%09betMoney = 0;%0A
 %09%09%09%09return T
@@ -1224,24 +1224,76 @@
 erOfWins++;%0A
+%09%09%09%09this.balance += betMoney * 2;%0A%09%09%09%09betMoney = 0;%0A
 %09%09%09%09return W
@@ -1330,24 +1330,42 @@
 rOfLoses++;%0A
+%09%09%09%09betMoney = 0;%0A
 %09%09%09%09return L

add betting