1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00
Commit graph

1375 commits

Author SHA1 Message Date
Marco Costalba
6a15df1d82 Revert bad capture pruning
After testing does not seem to increase ELO.

Indeed Glaurung is a little bit weaker, so revert.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-11 19:03:59 +02:00
Marco Costalba
bbf7a94d76 Better interface to get the current move type
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-06 05:44:23 +02:00
Marco Costalba
a3477af2a1 Allow to prune bad captures
Only good capture are preserved from futility pruning
and LMR reducing.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-06 05:44:23 +02:00
Marco Costalba
310e07f292 Teach MovePicker::get_next_move() to return move type
This will be used in future patches.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-06 05:44:22 +02:00
Marco Costalba
ea7bebb604 Fix single digit day in engine_name()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-05 10:37:05 +02:00
Marco Costalba
54071312f3 Add dbg_before() and dbg_after()
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>
2008-10-04 10:01:54 +02:00
Marco Costalba
849809e97e Space inflate Position::to_fen()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-04 09:50:19 +02:00
Marco Costalba
e9e51da4b8 position.cpp: fix a typo introduced by recent patch
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-28 10:59:20 +02:00
Marco Costalba
f1f887b6d7 Use relative values in piece square tables
So that will be automatically changed when
pieces values change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-28 10:59:08 +02:00
Marco Costalba
88bb3c9422 Start to cleanup position.cpp
Still a lot to do. No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-28 10:58:56 +02:00
Marco Costalba
8d76de820f Add dbg_hit_on_c(c, x) tool
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>
2008-09-28 10:58:47 +02:00
Marco Costalba
b00abed181 Space inflate evaluate_king()
This is the most complex piece of software
so far.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-26 05:54:49 +02:00
Marco Costalba
2e3faae067 Clarify difference between king zone and adjacent zone
There are subtle differences in the king evaluation
that should be clear to avoid misunderstandings.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-26 05:54:49 +02:00
Marco Costalba
453e815d4b Tidy up quick_evaluate()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-26 05:54:49 +02:00
Marco Costalba
3e0dc9ee84 Tidy up middle game specific evaluation
Also add starting position to benchmarks.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-26 05:54:49 +02:00
Marco Costalba
597ef38c39 Code style massage evaluate()
No functional changes.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-26 05:54:49 +02:00
Marco Costalba
d6618d7325 Add auto configuration for 32/64 bits
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>
2008-09-25 07:51:56 +02:00
Marco Costalba
3ee3cdc09b Evaluate: weight_option() is static
Declare function under local namespace. This removes a
warning from the picky Intel compiler.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:17:28 +02:00
Marco Costalba
ca891e9760 Cleanup read_weights() in evaluate.cpp
Exception to 80 colums rule here, but result
seems better.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:02:16 +02:00
Marco Costalba
dfcfed6432 Evaluate: rename king attack variables
A better naming IMHO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:02:15 +02:00
Marco Costalba
34ca22486a Further cleanup evaluate()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:02:15 +02:00
Marco Costalba
f56af8e84d Rename pawn_rank() in relative_rank()
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>
2008-09-24 21:02:15 +02:00
Marco Costalba
3263ee8557 Add also outposts evaluation in common code
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:02:14 +02:00
Marco Costalba
853ce65f17 Group common evaluate code
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>
2008-09-24 21:02:14 +02:00
Marco Costalba
7dd0c39714 Warnings termination fest
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>
2008-09-24 00:32:53 +02:00
Marco Costalba
060eef4f4e Do not use evaluate() for razoring
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>
2008-09-23 23:36:51 +02:00
Marco Costalba
67f975e56b init_eval: small cleanup
Functionality not changed.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-23 08:07:50 +02:00
Marco Costalba
1d8994402b Fix InitKingDanger initialization
Last line was missing.

Also reformat tables constants to be more readable.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-23 08:07:42 +02:00
Marco Costalba
2a3ebc884e Optimize pop_1st_bit() take 2
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>
2008-09-21 22:19:07 +02:00
Marco Costalba
01dd46a309 Change the name to Glaurung clone
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-21 11:51:38 +02:00
Marco Costalba
e5cc6f6b85 Switch to developer version numbering
Also clean up code while there.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-21 11:23:50 +02:00
Marco Costalba
29b01b6d82 Use optimized pop_1st_bit() only under Windows
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>
2008-09-20 22:19:54 +02:00
Marco Costalba
cde7b30b65 Add new superlinear interpolator
Faster transition and between phases and
more persistent during mid and ending game.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-20 21:56:46 +02:00
Marco Costalba
2dbc8feae3 Finally remove last old C style I/O stuff
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>
2008-09-20 06:53:06 +02:00
Marco Costalba
c034cce27c Convert book.cpp to use C++ I/O
Instead of old C stdio.h

Also small code clean up while there.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-19 13:53:36 +02:00
Marco Costalba
1373a00187 Final touches to pop_1st_bit optimization
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>
2008-09-19 05:33:55 +02:00
Marco Costalba
9ae2b69235 Optimize pop_1st_bit() on 32 bits x86
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>
2008-09-18 16:09:19 +02:00
Marco Costalba
95ce27f926 Ignore non keyboard events in Bioskey()
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>
2008-09-18 12:27:10 +02:00
Marco Costalba
5c4f6f6226 Cleanup poll()
Reshape this function in preparation
for future work.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:27:09 +02:00
Marco Costalba
18860cce40 Improve time managment
If we need some more and we are in time
advantage take it.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:27:09 +02:00
Marco Costalba
d583176baf Pass also opponent time to think()
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>
2008-09-18 12:27:09 +02:00
Marco Costalba
4c5eaeb363 Disable a stupid and noisy MSVC warning
Remove the crap from compiler messages.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:27:09 +02:00
Marco Costalba
925f97f4e7 Teach Benchmark to read positions from a file
This comes handy to test the engine on different
sets of positions, not only the 15 default ones.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:27:08 +02:00
Marco Costalba
f1e245850f Reformat benchmark interface
Prepare to following patches, still no functional
change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:26:39 +02:00
Marco Costalba
2f5012a3eb Fix another conversion warning: Bitboard->int
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:26:31 +02:00
Marco Costalba
94929c36bd Document where we want a uint16_t instead of a uint64_t
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>
2008-09-18 12:26:24 +02:00
Marco Costalba
a0aa8e760a Use size_t instead of int
Remove some warning.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:26:18 +02:00
Marco Costalba
52487c4f04 MovePicker: simplify move swapping
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>
2008-09-18 12:26:10 +02:00
Marco Costalba
5080e72ea5 Prefer strncpy() to strcpy()
This removes a warning under MSVC++

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:25:55 +02:00
Marco Costalba
295352d04a Fix: "Ponder" option has type bool not int
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:25:22 +02:00