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.
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.
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.
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.
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.
Now, Binomial[k][n] = Bin(k, n), instead of Binomial[k-1][n] = Bin(k, n).
Better document the Pascal triangle:
* Sum the above and the one to the left of it.
* Values outside the triangle are zero. This was not checked for k=n previously,
and the code implicitly relied on zero initialization of Binomial[]. That
reliance was made more confusing by the initial assignment before the loop.
No functional change.
This is a first step to cleanup that part of
initialization code.
Apparently init functions are harder to read now,
but this is only temporary: this is a prerequisite
for future work.
As a side benefit we can now get rid of the ancillary
struct and define them directly in teh main ones, even
using anonymous structs!