This final version is a little bit faster then
previous patch and is a bit cleaned up also.
On 32 bit x86 pop_1st_bit is now more then
two times faster then the original one that
is optimized for 64 bit processors.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Operations on 64 bits Bitboard types are slow
on x86 compiled with gcc, so optimize this case.
BTW profiling shows that pop_1st_bit() is a
veeery performance critical path!
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Filter out mouse and windows type events.
This fix an issue where Glaurung hangs in console mode
under Windows.
To reproduce simply open a console under Windows (cmd.exe),
run "glaurung.exe bench 50 1", this starts benchmarking.
Then hide the windows and show again or clik the mouse
somewhere on the window, this hangs the benchmark
because Boiskey() returns true and poll() calls std::getline()
that hangs waiting for user pressing a return key.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This patch modifies think() signature to accept
also opponent time. This is needed for future
changes to time managment.
Still no functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This patch removes some conversion warnings and
better describe where we are going to expect a
small integer.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
We don't need a full swap here because once found
and returned the best move will not be used again.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
When a move produces a beta-cut off is marked as
success in history and all the remaining ones are
marked as failures.
The loop across the searched moves, that is used
to register failures, does not skip the good one,
that is then registered as a failure too.
The patch fixes the bug and cleanup the code.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Add a very simple debug framework to
measure the hit rate of a given condition.
Simply insert macro
dbg_hit_on(x);
Anywhere you want to compute hit rate of condition x
and then call, as example in poll(), function
dbg_print_hit_rate() to print current results.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
sort() and sort_multipv() are almost the same, so
use only one implementation.
Also introduce the natural RootMove::operator<() to
compare the moves instead of compare_root_moves(),
this will allow to use std::sort instead of our
home grown bubble-sort.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Moves are already sorted, so just consider the best
and the second one.
Some trailing whitespace remove noise crept in due
to my editor removes it before to save.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
After testing and comparing output with standard Glaurung
a couple of issues arised.
A default value was wrong and init_uci_options() missed a couple
of stringify() calls. Also storing bool values as "false" and "true"
needs some care.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Instead of old-style C string functions use standard
library to greatly streamline the implementation.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Class UCIInputParser is now a typedef of a std::istringstream,
this greatly simplifies the code, especially the many conversions
from string to integer are now handled automatically by the
stream instead of relying on a chunk of C-style atoi() calls.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>