Example #1
0
        /// <summary>
        /// Creates a new instance of <see cref="Game"/>.
        /// </summary>
        /// <param name="options">Game options.</param>
        public Game(Options options)
        {
            gameOptions = options;

            PlayerWolf = new WolfPlayer(gameOptions.WolfPlayerName);

            // No rounding or parsing necessary.
            // Validation done by Options garantees the BoardSize is an even number,
            // making gameOptions.BoardSize / 2 always result in a uint.
            PlayerSheep = new SheepPlayer(gameOptions.BoardSize / 2, gameOptions.SheepPlayerName);

            Board = new Board(gameOptions.BoardSize);
            Board.SetupGamePieces(PlayerSheep);
        }
Example #2
0
 /// <summary>
 /// Checks if the Wolf player has won the game by reaching the
 /// original row of the sheep pieces.
 /// </summary>
 /// <param name="wolfPlayer">The Wolf player.</param>
 /// <returns>A boolean value representing if the wolf player has won.</returns>
 public bool GetHasWolfPlayerWon(WolfPlayer wolfPlayer)
 {
     return(wolfPlayer.Piece.BoardSquare.Pos.Row == Size - 1);
 }