1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00
Commit graph

3890 commits

Author SHA1 Message Date
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
Marco Costalba
976581339f Document sympat
Assorted renaming and reformat while there.

Hopefully it is more clear now!
2016-05-14 11:56:25 +02:00
Marco Costalba
a6ede54d59 Document Huffman decode 2016-05-14 10:46:30 +02:00
Marco Costalba
04f94b1538 Get rid of idxbits
Use indexSpan instead. This could be a teoretical
slwo down becuae we repalce some shifts by divide
and modulo, but this should not be measurable and
instead the code is more understandable now. This
is a big plus becuase this part of code is complex.
2016-05-14 08:20:20 +02:00
Marco Costalba
c0476e12db Start documenting decompress_pairs
Documenta and rename this difficult part
of the code. Still lot to do.
2016-05-14 08:08:28 +02:00
Marco Costalba
61a27cdadd Move set_map out of structs
To be aligned to other helper functions. Also
better document where DTZEntry is needed.
2016-05-13 18:40:58 +02:00
Marco Costalba
ee5aac2abc Always compute hasUniquePieces
Now that is part of the common fields, it
is natural always setthis memeber, even if
for pawns is not used.
2016-05-13 14:35:32 +02:00
Marco Costalba
018d907d74 Further merge enty init
And use references instead of pointers
2016-05-13 14:24:30 +02:00
Marco Costalba
9acb2b4b61 Merge Entry init functions 2016-05-13 13:31:12 +02:00
Marco Costalba
a357b70f6a Move hasUniquePieces to common fields
This allow to greatly simplify the code
and remove some SFINAE trick that now
is no more needed.
2016-05-11 00:14:47 +02:00
Marco Costalba
b13dd6c333 Retire 'symmetric'
And make explicit that WDLEntry and the corresponding
DTZEntry have the same principal key.
2016-05-10 18:56:42 +02:00
Marco Costalba
72bb4695d1 Fix an issue with pawn ordering
A subtle one because at leat 3 leading pawns
are needed to uncover this bug.

Found by stuwph
2016-05-10 17:52:15 +02:00
Marco Costalba
2681419141 Assorted small stuff 2016-05-09 16:12:53 +02:00
Marco Costalba
56d1bef249 Don't need to order pawns a second time 2016-05-09 10:58:56 +02:00
Marco Costalba
12c3e394e7 Retire Flap[] table
Just use the equivalent Ptwist[], renamed in
MapToEdges[] to indicate that gives highest
score to pawns near the edge and then, as
second order, to bottom rank squares.
2016-05-09 08:48:30 +02:00
Marco Costalba
410fa6c74a Compute also remaining tables 2016-05-08 21:31:43 +02:00
Marco Costalba
e01cdac536 Workaround broken MSVC zero-init 2016-05-08 19:07:29 +02:00
Marco Costalba
695eb4222a Fix a compile error with MSVC 2013 2016-05-08 17:52:51 +02:00
Marco Costalba
7a01beb441 Fix a warning with MSVC 2015 2016-05-08 17:39:59 +02:00
Marco Costalba
8d2eb34944 Fix DTZTable key check
We currently check onnly first key, while
we shoudl check both, as confirmed by
author on talkchess:

http://www.talkchess.com/forum/viewtopic.php?t=59947&start=30

This bug fix do not change functionality, we simply
find earlier the DTZ entry instead of reload it.
2016-05-08 15:03:13 +02:00
Marco Costalba
8baa476390 Compute also MapB1H1H7[] and MapA1D1D4[] 2016-05-08 14:49:05 +02:00
Marco Costalba
6f11b0438d Compute KK_idx[] at init time 2016-05-08 14:13:22 +02:00
Marco Costalba
f68df60fe5 Correctly handle shared 'ready' flag
Avoid ' double-checked locking' issue.
2016-05-08 12:51:01 +02:00
Marco Costalba
79051949ca Better clarify DTZEntry keys
Calrify that DTZ entry is initialized with
the same color of the corresponding WDL
entry.
2016-05-08 12:28:50 +02:00
Marco Costalba
875441db2b Use natural types for structs
Aslo changed PairsData::factor to uint64_t to
be aligned with recent fix 16019f47c8
2016-05-08 11:35:12 +02:00
Marco Costalba
9c35466295 Better document encoding 2016-05-08 10:03:53 +02:00
Marco Costalba
2a48e7a69c Simplify encoding of remaining pieces 2016-05-07 09:53:16 +02:00
Marco Costalba
24338c2c66 Some cleanup after previous big patch 2016-05-06 13:59:13 +02:00
Marco Costalba
6a260a7d66 Move all under probe_table()
Still some clean up to do but mainly
it is finished and it works!
2016-05-06 10:17:01 +02:00
Marco Costalba
7dd6e34c10 Call decompress_pairs() from within probe_table() 2016-05-06 09:11:35 +02:00
Marco Costalba
8abce63f34 Add pawns to encode_position() 2016-05-05 22:10:22 +02:00
Marco Costalba
16019f47c8 Fix a subtle overflow issue
Found by stuwph on 6-men TB.
2016-05-05 18:05:49 +02:00
Marco Costalba
e3cb2659f9 Retire some support tables
And rename MapB1D1D3[] to MapA1D1D4[] because
it is used to map piece on diagonal too when
we don't apply the 3-pieces encoding.
2016-05-03 16:48:25 +02:00
Marco Costalba
d9ec75a2ca Fully document piece enccoding
Use the original Ronald de Man explanations
on talkchess.
2016-05-03 07:03:08 +02:00
Marco Costalba
b20c26ad3b Better document set_sizes
In particular clarify the data layout.

Remove a bunch of useless casts while
there.
2016-05-01 13:20:31 +02:00
Marco Costalba
3328ab35bf Move some common fields under precomp 2016-05-01 09:53:28 +02:00
Marco Costalba
5cbbeaf28e Better document init() 2016-04-30 10:58:44 +02:00
Marco Costalba
6a802b2473 Rewrite number conversion functions 2016-04-30 07:55:33 +02:00
Marco Costalba
e4045c312b Unify set_norms() 2016-04-29 18:41:46 +02:00
Marco Costalba
431767b592 Merge DTZ initializations
I have also found a simpler way to avoid some
template gymnic.
2016-04-29 17:53:04 +02:00
Marco Costalba
ef69f37f82 Merge WDL initializations
Same initialization logic for both
pawns and pieces.

The advantage of this patch is that we reduce
redundancy and get a single (source) code path
for both cases. This is easier to understand
and to mantain.

Note: This patch makes use of some advanced template
techniques like SFINAE, decltype and the new function
declaration syntax (with trailing return type). This
is not just a show-off, but it is really needed in
this case.
2016-04-29 09:37:36 +02:00
Marco Costalba
7a600ed986 Unify set_factors()
This is needed for future work.
2016-04-29 07:37:56 +02:00
Marco Costalba
8ed3859aad Explicit size calculation
Remove the involved size[] array to get the
sizes from setup_pairs().

Now code it is more self-documenting because each
table is associated with its clear size.
2016-04-28 17:57:00 +02:00
Marco Costalba
a0d7801405 Use some more loops in WDLEntry::init
And remove a lot of code.
2016-04-28 16:13:15 +02:00
Marco Costalba
bfa2d923a7 Fix a compile issue with mingw 5.3 2016-04-28 14:04:29 +02:00
Marco Costalba
9cf110a2ae Get rid of PairsData allocation kludge
Currently we malloc a single memory
chunk in which we shuffle all kind of
different stuff in a very tricky way,
for instance see PairsData::base[1]
that is a hack used as a pointer to
data instead of an actual array (no
wonder C++ compiler complains!).

This patch rewrites all this in a way
to avoid hacky allocations and instead
to rely on the standard containers to
do their job.

This is the base for future work.
2016-04-28 13:59:09 +02:00