Other two debug utilities to compute filter rate.
Usage is:
dbg_before(); // counts passages from this point
if(..) // complex code stuff you want to audit
return/continue
if(...)
.....
dbg_after(); // counts passages from this point
Then somewhere in the code, normally in poll() add
dbg_print_hit_rate() and you will see the filter rate
of your code under auditing.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Like dbg_hit_on(x) but first filter out events and
only when condition 'c' is true the hit counter
is tested with 'x'.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
There are subtle differences in the king evaluation
that should be clear to avoid misunderstandings.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Instead of manually adjust defines in bitboard.h
now proper ones are automatically set.
It is anyhow possible to still set them manually
in case of problems.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
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>