public Player(string name, Board.SquareState squareState) { Name = name; if (squareState != Board.SquareState.Noughts && squareState != Board.SquareState.Crosses) { throw new InvalidPlayerException("A player must represent, either Noughts or Crosses"); } SquareState = squareState; }
public static char ToChar(this Board.SquareState square) { switch (square) { case Board.SquareState.Unchecked: return('_'); case Board.SquareState.Noughts: return('O'); case Board.SquareState.Crosses: return('X'); default: throw new ArgumentOutOfRangeException(nameof(square), square, null); } }