It is more clear, at last for me.
Also cleanup evaluate_rook() and evaluate_queen()
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This removes code redundancy but perhaps
impact performance due to uninlining.
Testing for regression is needed. For now
aim to best code readibility.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
A bunch of Intel C++ warnings removed, other silent out.
Still few remaining but need deeper look.
Also usual whitespace crap removal noise.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Because razoring is reached 10% of times and about 50% of time
first two conditions are met we can save 5% of calls to the fairly
costly evaluate().
On the other side statistics have shown 95% of nodes that pass
the first two razoring conditions pass also the evaluate() test.
So the risk of dropping the third condition seems low enough.
Testing seems to validate this.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This time we use MSVC intrinsics that are
C wrappers for Intel assembler 'bsf' instruction.
The speed up in node count is around 3%, probably
it does not worth the effort. Anyway this patch
can be useful at least for documentation purposes.
This optimization covers 32 bit systems only.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Under Linux we have a segfault after a random time,
about a couple of minutes while running the benchmark.
This happens both with gcc and icc, and both with O2
and O3 optimizations.
Disable for Linux until we understand what's the deal.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Now I/O is fully done with C++ iostreams.
The only exception is in non-windows version
of Bioskey() in misc.cpp
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
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>