コード例 #1
0
ファイル: Player.cs プロジェクト: camachorm/JobHunting
 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;
 }
コード例 #2
0
        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);
            }
        }