Exemple #1
0
        public Outcome Play(PacType enemy)
        {
            if (_type == enemy._type)
            {
                return(Outcome.Draw);
            }

            if ((_type == "ROCK" && enemy._type == "PAPER") ||
                (_type == "PAPER" && enemy._type == "SCISSORS") ||
                _type == "SCISSORS" && enemy._type == "ROCK")
            {
                return(Outcome.Loss);
            }

            return(Outcome.Win);
        }
Exemple #2
0
        public static PacType ToBeat(PacType type)
        {
            switch (type.ToString())
            {
            case "PAPER":
                return(Scissors);

            case "ROCK":
                return(Paper);

            case "SCISSORS":
                return(Rock);

            default:
                return(Rock);
            }
        }
Exemple #3
0
 public bool Equals(PacType other)
 {
     return(_type == other._type);
 }