47 std::ostringstream str;
49 std::cout << std::setfill(
' ') << std::setw(10) << std::left << str.str();
56 Debug(NAMESPACE_DEBUG::init());
57 Debug(libcw_do.off());
59 time_t seed = 1220638382;
64 std::vector<Move> game;
67 static int random_numbers[5000000];
70 for (
int i = 0; i < 5000000; ++i)
71 random_numbers[i] = std::rand();
77 struct timeval before, after;
78 gettimeofday(&before, NULL);
93 Move* move_save = move_ptr;
94 for (
int i = 0; i < 100; ++i)
99 move_iter != move_end;
102 * move_ptr++ =* move_iter;
108 int number_of_moves = move_ptr - moves;
109 Move_count += number_of_moves;
110 if (number_of_moves == 0)
112 int mn = random_numbers[total_moves] % number_of_moves;
115 if (chess_position.
execute(moves[mn]))
120 while (games < 10000);
122 gettimeofday(&after, NULL);
126 for (std::vector<Move>::iterator iter = game.begin(); iter != game.end(); ++iter)
129 Move const& move(*iter);
130 print_move(chess_position, move);
134 std::cout << std::endl;
137 std::cout <<
"Number of games played: " << games <<
"\nTotal number of moves played: " << total_moves << std::endl;
139 timersub(&after,& before,& after);
140 uint64_t t = after.tv_sec;
143 std::cout <<
"Generated Move objects: " << (
unsigned long)(Move_count / (t / 1000000.0) + 0.5) <<
" Moves/second." << std::endl;
144 std::cout <<
"Executed ply: " << (
unsigned long)(total_moves / (t / 1000000.0) + 0.5) <<
" ply/second." << std::endl;
145 std::cout <<
"Computing time: " << ((double)t / total_moves) <<
" microseconds per executed move (ply)." << std::endl;
A namespace for all chess related objects that are not related to the GUI.
bool execute(Move const& move)
Execute move move.
ColorData const white
A constant representing the color white.
A chess move in a particular chess position.
MoveIterator move_begin(Index const& index) const
Return an iterator to the first move of the piece at index index.
Non-mutable iterator over all moves of a given chess piece.
A helper class to write other objects to an ostream.
unsigned int full_move_number(void) const
Return the full move number.
PieceIterator piece_end(void) const
Return an iterator one beyond the last piece.
PieceIterator piece_begin(Color const& color) const
Return an iterator to the first piece of color color.
This file contains the definition of class PieceIterator.
void to_move(Color const& color)
Explicitly set whose turn it is.
This file contains the declaration of class ChessPosition.
This file contains the declaration of class MoveIterator.
Non-mutable iterator over selective chess pieces in a chess position.
void initial_position(void)
Set up the initial position.
This file contains the declaration of class ChessNotation.
ColorData const black
A constant representing the color black.