public class rockPaperScissors
{
	public static void main (String args[])
	{
		new rockPaperScissors ();
	}


	/* On this program, you are working with a team....
       The responsibility of the other person on the team
	   was to code the constructor.
       Your job is to code the other methods.
       Follow the comments.
       You are not allowed to edit the constructor.
	 */

	public rockPaperScissors ()
	{
		int cPoint = 0;
		int uPoint = 0;
		int game = 1;
		char playAgain = 'y';
		System.out.println ("-----Rock, Paper, Scissors------\n");
		System.out.println ("	        _______");
		System.out.println ("	    ---'   ____)");
		System.out.println ("	          (_____)");
		System.out.println ("	          (_____)");
		System.out.println ("	          (____)");
		System.out.println ("	    ---.__(___)\n");

		System.out.println ("	        _______");
		System.out.println ("	    ---'   ____)____");
		System.out.println ("	              ______)");
		System.out.println ("	              _______)");
		System.out.println ("	             _______)");
		System.out.println ("	    ---.__________)\n");

		System.out.println ("	        _______");
		System.out.println ("	    ---'   ____)____");
		System.out.println ("	              ______)");
		System.out.println ("	           __________)");
		System.out.println ("	          (____)");
		System.out.println ("	    ---.__(___)\n");
		
		while (playAgain == 'y')
		{
			char user = userChoice ();
			System.out.println ("You have selected " + user);
			char comp = compChoice ();
			System.out.println ("The computer has selected " + comp);
			char win = winner (comp, user);
			if (win == 'c')
			{
				cPoint++;
				System.out.println ("\nThe computer wins!");
			}
			else if (win == 'u')
			{
				uPoint++;
				System.out.println ("\nYou win!");
			}
			else
				System.out.println ("\nThere is a tie!");
			System.out.println ("Points: You: " + uPoint + " Computer: " + cPoint);
			playAgain = IO.inputChar ("\nPlay again? (y/n) ");
			System.out.println ("");
		}
		System.out.println ("Goodbye!");
	}


	public boolean isValid (String c)
	{
		/* TO DO: Finish the if. its needs to check P and S too.
			      return true if valid, false otherwise
		 */
		if(c.equalsIgnoreCase("Rock")|| c.equalsIgnoreCase("R"))
			return true;
		else
			return false;
	}


	public char userChoice ()
	{ //returns r, p or s, based on the user's choice

		//TO DO: print options: rock, paper, scissors


		String pick = IO.inputString ("Choice? (r/p/s) ");

		while(!isValid(pick)) {
			pick = IO.inputString ("Choice? (r/p/s) ");
		}
		//TO DO: make an if to standardize values
		//if you've got one of Rock, ROCK, rock, r, R, then return 'r'.
		//else if you've got one of Paper, PAPER, paper, p, P, then return 'p'.
		//else return 's';

		return 's';

	}




	public char compChoice ()
	{ //TO DO: make a random number between 1 and 3


		//TO DO: if the number is 1, return r; 2 return s; 3 return p

		return 'r';
	}


	public char winner (char comp, char user)
	{ //Parameter info: comp and user both hold one of r, s, p
		//returns c for computer, u for user and b for both

		//TO DO: complete the if for the other winning conditions
		if(comp=='s' && user=='p')
			return 'c';

		else 
			return 'u';
	}
}


