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

3945 commits

Author SHA1 Message Date
Marco Costalba
526499f3ee TB debug framework
Call both new and reference functions in parallel
and verify return values match.

Log to file any difference to allow debugging while
playing real games.
2016-05-26 18:58:30 +02:00
Marco Costalba
3ea9928f55 Revert "Add DTZ to WDL hash table"
This reverts commit 19bc074c18.
2016-05-26 18:57:57 +02:00
Marco Costalba
19bc074c18 Add DTZ to WDL hash table
A single hash table to store both pointers.

Greatly simplify code.
2016-05-26 18:51:25 +02:00
Marco Costalba
ff3165286c Make DTZEntry init() thread safe 2016-05-26 10:48:26 +02:00
Marco Costalba
5ebd56ebd8 Retire pos_code() 2016-05-26 10:20:44 +02:00
Marco Costalba
32c1f1da26 Rearrange WDLEntry API
To avoid using temporaries like keys[]
2016-05-26 09:54:16 +02:00
Marco Costalba
107750279d Move file name setup inside init() 2016-05-26 09:26:48 +02:00
Marco Costalba
ac136ea72b De-templetize a couple of functions
Use simple overloads instead.
2016-05-26 09:12:50 +02:00
Marco Costalba
c920c6c807 Improve some comments 2016-05-25 11:31:01 +02:00
Marco Costalba
23a548feaa Small tweak in probe_dtz() 2016-05-24 13:10:31 +02:00
Marco Costalba
09139d87cb Fix an issue with only capture moves
When the only legal moves are captures, then
probe_wdl_table() returns a wrong score.
2016-05-24 10:10:22 +02:00
Marco Costalba
f852b0ed8f Hanlde mate position in dtz probe
Stick to the original code behaviour.
2016-05-24 09:50:56 +02:00
Marco Costalba
36d6a1fd0a Third attempt: hopefully the last one 2016-05-23 09:26:18 +02:00
Marco Costalba
de5a03ff0f Second attempt at dtz loop 2016-05-22 15:53:57 +02:00
Marco Costalba
e9e9cfa9bf Further simplify opponent side DTZ search 2016-05-22 10:24:44 +02:00
Marco Costalba
eb16759a48 Explicitly initialize 'ready' flag 2016-05-22 09:49:03 +02:00
Marco Costalba
0610a13789 Initialize result before probing 2016-05-22 07:28:54 +02:00
Marco Costalba
8925a28cf1 Fix ep move for real this time 2016-05-21 21:51:23 +02:00
Marco Costalba
db8112ec9e Fix issue and rewrite search() flags 2016-05-21 21:39:04 +02:00
Marco Costalba
3731213994 Further simplify probe_dtz() loop conditions 2016-05-21 20:27:28 +02:00
Marco Costalba
6a6a7d2b22 Make probe_dtz_table() return correct dtz 2016-05-21 19:55:32 +02:00
Marco Costalba
96314cc971 Prefer readibility to (useless) optimization 2016-05-21 19:43:36 +02:00
Marco Costalba
de335433ea Added 'wdl' and 'dtz' UI debug commands
Probe WDL and DTZ tables on current position.
2016-05-21 15:14:50 +02:00
Marco Costalba
0700912dc5 Further improve probe_dtz() 2016-05-21 10:58:09 +02:00
Marco Costalba
0b040243ba Remove ep specific code from dtz probe 2016-05-21 10:43:34 +02:00
Marco Costalba
47e21c274d More work in probe_dtz_no_ep() 2016-05-21 10:33:53 +02:00
Marco Costalba
bea98066a0 Integrate WIN_PAWN_MOVE into the search() loop 2016-05-21 09:53:47 +02:00
Marco Costalba
4b068d50f6 Strong type probe state 2016-05-21 08:30:46 +02:00
Marco Costalba
af95d27fd7 Fix enpassant case to handle 2 ep moves 2016-05-21 07:31:03 +02:00
Marco Costalba
6eb670ad37 Integrate ENPASSANT in the search 2016-05-20 19:01:48 +02:00
Marco Costalba
9a0f8b38c3 BENCH CHANGE! Switch to new loop cycle
Bench change is due to different move
generation order. But functionality
remains the same.
2016-05-19 19:11:38 +02:00
Marco Costalba
8634305cb9 Test new loop cycle in probe_ab()
Currently we return as soon as we reach
beta. This makes the bench signature to
depend on the move order in case we have
more than one possible capture and only
one of them reach beta then the nodes
searched are different in case we first
test one capture or the other.

Verify that the best value found by the
two move llops are the same. This check
will allow to remove old loop, replaced
by new one.
2016-05-19 18:56:25 +02:00
Marco Costalba
7dc41c7929 Document probe_ab() 2016-05-19 11:41:30 +02:00
Marco Costalba
b465f2b44a Don't init second WDLEntry when symmetric 2016-05-18 22:20:43 +02:00
Marco Costalba
66456590d7 More stuff 2016-05-18 07:20:45 +02:00
Marco Costalba
6233830b9b Assorted small stuff 2016-05-17 22:21:44 +02:00
Marco Costalba
8bedb19690 Sync with master
Verified against master with 4-men and
partially 5-men tables.
2016-05-17 13:56:51 +02:00
Marco Costalba
99458025ba Fix sorting of leading pawns
Currently we sort leading pawns before
to flip. This is ok becuase MapPawns[] is
(almost) flip invariant apart for the case
of two symmetric non-leading pawns like the
case of d2, e2, h2.

After MapPawns[] sorting we have  h2, d2, e2
with values 46, 11, 10. Then we flip because
leading pawns is in h2 -> a2,e2,d2 with values
46,10,11. So this is not sorted anymore.

The fix is to sort after flipping. And instead
of forst sorting just pick the leading pawn
directly.
2016-05-17 12:40:55 +02:00
Marco Costalba
28d497e00c Some more additional doc on encoding 2016-05-16 23:21:57 +02:00
Marco Costalba
f5ac865866 Init MapToEdges[] with other tables
And simplify LeadPawnIdx[] usage.
2016-05-16 18:21:15 +02:00
Marco Costalba
1cbaaaef68 Document Pawnidx[] and Pfactor[] 2016-05-16 10:08:11 +02:00
Marco Costalba
306561431b Clarify why blockLengthSize > blocksNum
Ronald de Man says:

This difference has to do with the fact that the "sparse index"
does not point to "k * d->span", but to "k * d->span + d->span / 2".

Since k = idx / d->span, we know that k * d->span <= idx,
so k * d->span is a valid index into the table.
But k * d->span + d->span / 2 might be a value that is bigger than
the largest index for the table (if "idx" happens to be near the
end of the table).

So the last valid entry in the SparseIndex[] array might have
to a point to a block and (sub)index that is not part of the
real table but comes "after" it. To make this work, the generator
adds entries for a few "fake" blocks, each of maximum size 65536,
to the blockLength[] array so that there is something to point to
for the last valid entry in the SparseIndex[] array.

These fake blocks do not correspond to any compressed data.

So the fake blocks avoid the need to detect and handle this special
case in decompress_pairs().
2016-05-15 18:18:09 +02:00
Marco Costalba
7448fce808 Simplify Pawnidx[] init code
But still not clear what we have here...
2016-05-15 14:46:38 +02:00
Marco Costalba
e435f85b02 Document (and refactor) norms and factors 2016-05-15 10:20:45 +02:00
mstembera
0784bd542b Fix a multiPV bug in lazy SMP
Where the helper threads were not doing multiPV at all.

Regression tested sprt @ 5+0.05 th 7

LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 73918 W: 11891 L: 11853 D: 50174

bench: 8716243
2016-05-14 21:34:55 +02:00
Marco Costalba
e16d269622 Fix a typo that leads to a crash
Oddly nough the crash appear only under Windows,
not under Linux.
2016-05-14 21:01:54 +02:00
Marco Costalba
c2d9cdcaff Relicense under GPL
With original author acknowledgment:
http://www.talkchess.com/forum/viewtopic.php?t=59947&postdays=0&postorder=asc&topic_view=flat&start=30
2016-05-14 17:50:31 +02:00
Marco Costalba
57c229a7a2 Small tweak to decode loop 2016-05-14 14:50:10 +02:00
Marco Costalba
7dd8fd77b2 Set a specific type for a symbol
And other assorted small stuff and docs
2016-05-14 14:32:46 +02:00
Marco Costalba
1a88103633 Streamline calc_symlen() 2016-05-14 12:22:50 +02:00