Exemplo n.º 1
0
        public override string GenerateRoshambo()
        {
            rand = new Random();
            int random = rand.Next(0, 3);

            RoshamboValue value = new RoshamboValue(random);

            return(value.GenerateValue());

            //switch (random)
            //{
            //    case 0:
            //        return Roshambo.Rock.ToString();
            //        break;
            //    case 1:
            //        return Roshambo.Paper;
            //        break;
            //    case 2:
            //        return Roshambo.Scissors;
            //        break;
            //    default:
            //        return Roshambo.Rock;
            //        break;
            //}
        }
Exemplo n.º 2
0
        public override string GenerateRoshambo()
        {
            try
            {
                Console.WriteLine(Name + ": throw rock, paper, or scissors?");
                string input = Console.ReadLine().Trim().ToLower();

                if (input == "rock")
                {
                    RoshamboValue value = new RoshamboValue(0);
                    return(input.ToString());
                }

                else if (input == "paper")
                {
                    RoshamboValue value = new RoshamboValue(1);
                    return(input.ToString());
                }

                else if (input == "scissors")
                {
                    RoshamboValue value = new RoshamboValue(2);
                    return(input.ToString());
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (Exception e)
            {
                return("Invalid entry");
            }
        }
Exemplo n.º 3
0
        public override string GenerateRoshambo()
        {
            RoshamboValue value = new RoshamboValue(0);

            return(value.GenerateValue());
        }