Example #1
0
 /// <summary>Returns whether or not the checkers piece can be moved this turn.</summary>
 /// <param name="piece">The checkers piece to test.</param>
 /// <returns>True when piece can be moved.</returns>
 public bool CanMovePiece(CheckersPiece piece)
 {
     if ((!isPlaying) && (winner == 0))
     {
         throw new InvalidOperationException("Operation requires game to be playing.");
     }
     if (piece == null)
     {
         throw new ArgumentNullException("piece");
     }
     if (!pieces.Contains(piece))
     {
         throw new ArgumentException("Argument 'piece' must be a piece in play to the current game.");
     }
     return(piece.Player == turn);
 }