コード例 #1
0
ファイル: TextIO.cs プロジェクト: Chessforeva/Csharp4chess
 /*throws ChessParseError */
 private static void safeSetPiece(Position pos, int col, int row, int p)
 {
     if (row < 0) throw new ChessParseError(/* "Too many rows" */);
     if (col > 7) throw new ChessParseError(/* "Too many columns" */);
     if ((p == Piece.WPAWN) || (p == Piece.BPAWN)) {
     if ((row == 0) || (row == 7))
         throw new ChessParseError(/* "Pawn on first/last rank" */);
     }
     pos.setPiece(Position.getSquare(col, row), p);
 }