rendered paste body
/**
* -------------------------------------------------------------------|
* Rock, paper, scissors game class.
*
* @author (Dustin Baker)
* @version (10/31/07)
*/
import java.util.Scanner;
public class Game
{
private String response;
private Scanner scanIn;
public Game()
{
this.response = "";
}
public void eval()
{
if (response.equals("yes"))
{
//playGame();
}
else if (response.equals("no"))
{
quit();
}
else
{
System.out.println("Please enter yes or no only.");
response = scanIn.nextLine();
//response.eval();
}
}
public void go()
{
Player player1 = new Player();
Player player2 = new Player();
Scanner scanIn = new Scanner (System.in);
System.out.println("Would you like to play a game of " +
"rock, paper, scissors?");
String response = scanIn.nextLine();
response.eval();
}
//private void playGame()
//{
// a = math.random<3
// if a = 0
// rock
// else if a = 1
// paper
// else scissors
// player1 = a
// a = math.random<3
// if a = 0 rock
// else if a = 1 paper
// else scissors
// player2 = a
// player1.vs(player2);
//}
//private void vs(Player p2)
//{
// if (this.equals(p2))
// {
// System.out.println("It's a tie.");
// }
// else if (this.equals("rock") && p2.equals("paper"))
// {
// System.out.println("Player 2 wins!");
// }
// else if (this.equals("rock") && p2.equals("scissors"))
// {
// System.out.println("player1 wins");
// }
// else if (this.equals("paper") && p2.equals"rock"))
// {
// System.out.println("player1 wins");
// }
// else if (this.equal("paper") && p2.equals("scissors"))
// {
// System.out.println("player2 wins");
// }
// else if (this.equals("scissors") && p2.equals("rock"))
// {
// System.out.println("player2 wins");
// }
// else
// {
// System.out.println("player1 wins");
// }
// }
private void quit()
{
System.out.println("Thanks for playing.");
}
}
class Player
{
public Player()
{
}
}