Ejemplo n.º 1
0
 //int Score;
 public new Pick userPick()
 {
     Random random = new Random();
     int roll = random.Next(5);
     if (roll == 0)
     {
         Rock rock = new Rock();
         return rock;
     }
     else if (roll == 1)
     {
         Paper paper = new Paper();
         return paper;
     }
     else if (roll == 2)
     {
         Scissors scissors = new Scissors();
         return scissors;
     }
     else if (roll == 3)
     {
         Spock spock = new Spock();
         return spock;
     }
     else if (roll == 4)
     {
         Lizard lizard = new Lizard();
         return lizard;
     }
     else
     {
         userPick();
         return new Rock();
     }
 }
Ejemplo n.º 2
0
        //new string Name;
        //int Score;



        ////string input;        

        ////public void setScore(int Score)
        ////{
        ////    this.Score = Score;
        ////}
        ////public int getScore()
        ////{
        ////    return this.Score;
        ////}
        public override Pick userPick()
        {
            //Pick value;
            Console.WriteLine("Press  R-Rock, P-Paper, S-Scissors, Sp-Spock, L-Lizard");
            string input = Console.ReadLine();
            //Console.Clear();
            if (input == "r")
            {
                Rock rock = new Rock();
                return rock;
            }
            else if (input == "p")
            {
                Paper paper = new Paper();
                return paper;
            }
            else if (input == "s")
            {
                Scissors scissors = new Scissors();
                return scissors;
            }
            else if (input == "sp")
            {
                Spock spock = new Spock();
                return spock;
            }
            else if (input == "l")
            {
                Lizard lizard = new Lizard();
                return lizard;
            }
            else
            {
                userPick();
                return null;
            }
        }