示例#1
0
        public Player Winner()
        {
            var _winner = PlayerOne;

            bool playersHaveDifMoves = PlayerOne.GetMove().MoveKind() != PlayerTwo.GetMove().MoveKind();

            if (playersHaveDifMoves &&
                PlayerTwo.GetMove().Win(PlayerOne.GetMove()))
            {
                _winner = PlayerTwo;
            }

            return(_winner);
        }
 public Player GetTurnWinner()
 {
     if (player1.GetMove() == player2.GetMove())
     {
         return(player1);
     }
     else if (player1.GetMove() == "rock" && (player2.GetMove() == "scissors" || player2.GetMove() == "lizard"))
     {
         player1.PlayerWin();
         return(player1);
     }
     else if (player1.GetMove() == "paper" && (player2.GetMove() == "rock" || player2.GetMove() == "spock"))
     {
         player1.PlayerWin();
         return(player1);
     }
     else if (player1.GetMove() == "scissors" && (player2.GetMove() == "paper" || player2.GetMove() == "lizard"))
     {
         player1.PlayerWin();
         return(player1);
     }
     else if (player1.GetMove() == "lizard" && (player2.GetMove() == "spock" || player2.GetMove() == "paper"))
     {
         player1.PlayerWin();
         return(player1);
     }
     else if (player1.GetMove() == "spock" && (player2.GetMove() == "scissors" || player2.GetMove() == "rock"))
     {
         player1.PlayerWin();
         return(player1);
     }
     else
     {
         player2.PlayerWin();
         return(player2);
     }
 }