Ejemplo n.º 1
0
        public override string GenerateRoshambo()
        {
            // 0 passed to RoshamboValue corresponds to the 0 index in a list containing "rock", "paper", "scissors".
            RoshamboValue value = new RoshamboValue(0);

            return(value.GenerateValue());
        }
        // Ask the FreeWillUsers to throw rock, paper, or scissors.
        public override string GenerateRoshambo()
        {
            Console.WriteLine();
            Console.WriteLine($"{Name} - throw rock, paper, or scissors?");
            Console.Write(": ");
            string input = Console.ReadLine().Trim().ToLower();

            // Integers passed to RoshamboValue correspond to indecies in a list containing "rock", "paper", "scissors".
            if (input == "rock")
            {
                RoshamboValue value = new RoshamboValue(0);
                return(value.GenerateValue());
            }
            else if (input == "paper")
            {
                RoshamboValue value = new RoshamboValue(1);
                return(value.GenerateValue());
            }
            else if (input == "scissors")
            {
                RoshamboValue value = new RoshamboValue(2);
                return(value.GenerateValue());
            }
            else
            {
                Console.WriteLine("Invalid input. Please try again.");
                return(GenerateRoshambo());
            }
        }
Ejemplo n.º 3
0
        public override string GenerateRoshambo()
        {
            int random = R.Next(0, 3);
            // random passed to RoshamboValue corresponds to an index in a list containing "rock", "paper", "scissors".
            RoshamboValue value = new RoshamboValue(random);

            return(value.GenerateValue());
        }