60 int main(
int argc,
char* argv[])
62 Debug(NAMESPACE_DEBUG::init());
68 std::cout <<
"sizeof(Color) = " <<
sizeof(
Color) <<
'\n';
69 assert(
sizeof(
Color) == 1);
70 std::cout <<
"sizeof(Index) = " <<
sizeof(
Index) <<
'\n';
71 assert(
sizeof(
Index) == 1);
72 std::cout <<
"sizeof(Code) = " <<
sizeof(
Code) <<
'\n';
73 assert(
sizeof(
Code) == 1);
74 std::cout <<
"sizeof(Flags) = " <<
sizeof(
Flags) <<
'\n';
75 assert(
sizeof(
Flags) == 1);
76 std::cout <<
"sizeof(Piece) = " <<
sizeof(
Piece) <<
'\n';
78 std::cout <<
"sizeof(BitBoard) = " <<
sizeof(
BitBoard) <<
'\n';
80 std::cout <<
"sizeof(CountBoard) = " <<
sizeof(
CountBoard) <<
'\n';
82 std::cout <<
"sizeof(CastleFlags) = " <<
sizeof(
CastleFlags) <<
'\n';
84 std::cout <<
"sizeof(EnPassant) = " <<
sizeof(
EnPassant) <<
'\n';
99 std::cout <<
"Sum is " << sum <<
'\n';
101 std::cout <<
"sizeof(ChessPosition) = " <<
sizeof(
ChessPosition) <<
'\n';
104 Dout(dc::warning,
"ChessPosition is not compact!?!");
115 std::string str(argv[1]);
116 std::cout <<
"Loading \"" << str <<
"\".\n";
118 if (chess_position.load_FEN(str))
119 std::cout <<
"Loading successful\n";
121 std::cout <<
"Loading failed!\n";
124 chess_position.initial_position();
126 std::cout <<
"FEN code is: \"" << chess_position.FEN() <<
"\".\n";
128 std::vector<Move> moves;
129 Color color(chess_position.to_move());
131 for (
PieceIterator piece_iter = chess_position.piece_begin(color); piece_iter != piece_end; ++piece_iter)
134 for (
MoveIterator iter = chess_position.move_begin(piece_iter.index()); iter != move_end; ++iter)
135 moves.push_back(*iter);
137 std::cout <<
"There are " << moves.size() <<
" moves: ";
139 for (std::vector<Move>::iterator iter = moves.begin(); iter != moves.end(); ++iter)
147 std::cout << std::endl;
ArrayColor< BitBoard > M_pinning
Squares between attacker and king for actually pinned pieces (including attacker).
A namespace for all chess related objects that are not related to the GUI.
EnPassant M_en_passant
A pawn that can be taken en passant, or zeroed if none such pawn exists.
uint8_t M_half_move_clock
Number of half moves since the last pawn advance or capture.
Flags representing the state of a piece on the chessboard.
Non-mutable iterator over all moves of a given chess piece.
A helper class to write other objects to an ostream.
ArrayIndex< Piece > M_pieces
A piece per square. The index of the array is an Index.
ArrayColor< CountBoard > M_defended
The number times a square is defended.
ArrayColor< BitBoard > M_attackers
Bitboards for squares of enemy pieces on the same line as the king and all squares in between...
An object representing en passant information.
A one-boolean-per-square chessboard.
The index of a chess square.
CastleFlags M_castle_flags
Whether black and white may castle long or short.
uint16_t M_full_move_number
The number of the full move. It starts at 1, and is incremented after Black's move.
ArrayCode< BitBoard > M_bitboards
Bitboards reflecting the current position.
A class to keep track of castling rights.
A particular piece on the board.
bool M_double_check
Cached value of wether or not M_to_move is in double check.
A chess piece type including color.
This file contains the declaration of class ChessPosition.
A color (black or white).
Color M_to_move
The active color.
This file contains the declaration of class MoveIterator.
Non-mutable iterator over selective chess pieces in a chess position.
This file contains the declaration of class ChessNotation.
ArrayColor< uint8_t > M_king_battery_attack_count
The number of times that a king is& #39;attacked' by pieces behind another attacker.