Site hosted by Angelfire.com: Build your free website today!

import java.util.Random;
/* Implements game elements of Rock Paper Scissors
*
* @Mike Scott * @version 1.1 */ public class RockPaperScissorsGame
{ public static final int ROCK = 1;

public static final int PAPER = 2;
public static final int SCISSORS = 3;
private int humanChoice;
private int ComputerChoice;
private int HumanWins;
private int ComputerWins;
private int Ties;
private int getComputerWins;
private int getHumanWins;
private int getTies;
private String getOverallGameStatus;
private String GameResult;
private int Value;
private int human;
public RockPaperScissorsGame()
{ HumanWins = 0;
ComputerWins = 0;
Ties = 0;
} public void reset()
{HumanWins=0;
ComputerWins=0;
Ties=0;
}

public int getComputerWins()
{ return getComputerWins;
}

public int getHumanWins()
{return getHumanWins;
}

public int getTies()
{return getTies;
}

public String getGameResults()
{ String result = "";
if (humanChoice == 1 && ComputerChoice == 3){
result = ("You Chose Rock and Computer Player
Chose Scissors Human Player Wins");}
else if (humanChoice == 2 && ComputerChoice
== 1){ result = ("You Chose Paper and Computer
Player Chose Rock Human Player Wins");}
else if (humanChoice == 3 && ComputerChoice
== 2){
result = ("You Chose Scissors and Computer
Player Chose Paper Human Player Wins");}
else if (humanChoice == 1 && ComputerChoice
== 1){
result = ("You Chose Rock and Computer Player
Chose Rock The game is a Tie");}
else if (humanChoice == 2 && ComputerChoice
== 2){
result = ("You Chose Paper and Computer
Player Chose Paper The game is a Tie");}
else if (humanChoice == 3 && ComputerChoice
== 3){ result = ("You Chose Scissors and Computer
Player Chose Scissors The game is a Tie");}
else if (humanChoice == 3 && ComputerChoice
== 1){
result = ("You Chose Scissors and Computer
Player Chose Rock Computer Player Wins");}
else if (humanChoice == 1 && ComputerChoice
== 2){
result = ("You Chose Rock and Computer Player
Chose Peper Computer Player Win");}
else if (humanChoice == 2 && ComputerCh
oice
== 3){ result = ("You Chose Paper and Computer
Player Chose Scissors Computer Player Win");}
else; {return "result"+humanChoice +
ComputerChoice;}


}
public String getOverallGameStatus()
{
String result = "";
if ((HumanWins - ComputerWins) >= 5){
result = "UR 1337";}
else if ((HumanWins - ComputerWins) == 4){
result = "U Beat the Computer Congrats";}
else if ((HumanWins - ComputerWins) == 3) {
result = "U Beat the Computer Congrats";}
else if ((HumanWins - ComputerWins) == 2){
result = "U Beat the Computer Congrats";}
else if ((HumanWins - ComputerWins) == 1){
result = "U Beat the Computer Congrats";}
else if ((HumanWins - ComputerWins) == -4){
result = "ur loosing ";}
else if ((HumanWins - ComputerWins) == -3){
result = "ur loosing ";}
else if ((HumanWins - ComputerWins) == -2){
result = "ur loosing ";}
else if ((HumanWins - ComputerWins) == -1){
result = "ur loosing";}
else if ((HumanWins - ComputerWins) <= -5){
result = "U SUX";}
else {result = "";}

return result;


} public void play(int humanChoice)
{
Random rand = new Random();
ComputerChoice = rand.nextInt(3)+1;
humanChoice=3;
if (humanChoice == 1 && ComputerChoice == 3){
HumanWins = +1;}
else if (humanChoice == 2 && ComputerChoice
== 1){
HumanWins = +1;}
else if (humanChoice == 3 && ComputerChoice
== 2){
HumanWins = +1;}
else if (humanChoice == 1 && ComputerChoice
== 1){
Ties = +1;}
else if (humanChoice == 2 && ComputerChoice
== 2){
Ties = +1;}
else if (humanChoice == 3 && ComputerChoice
== 3){
Ties = +1;}
else if (humanChoice == 3 && ComputerChoice
== 1){
ComputerWins = +1;}
else if (humanChoice == 1 && ComputerChoice
== 2){
ComputerWins = +1;}
else if (humanChoice == 2 && ComputerChoice
== 3){
ComputerWins = +1;}
else;{}
}}