1
0
Fork 0
Commit Graph

665 Commits (riscv64-cartesi)

Author SHA1 Message Date
mstembera 385deefd80 Fix sometimes incorrect key for prefetches
STC
https://tests.stockfishchess.org/tests/view/61737b4f6ce927be32558401
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 138712 W: 34914 L: 34942 D: 68856
Ptnml(0-2): 421, 14817, 38894, 14817, 407

Very minor tweak since Position::key() depends on the 50 move rule counter.
Comments: cddde31eed

closes https://github.com/official-stockfish/Stockfish/pull/3759

No functional change
2021-10-25 12:26:44 +02:00
pb00067 f4986f4596 SEE: simplify stm variable initialization
Pull #3458 removed the only usage of pos.see_ge() moving pieces that
don't belong to the side to move, so we can simplify this, adding an assert.

closes https://github.com/official-stockfish/Stockfish/pull/3607

No functional change
2021-07-13 17:31:15 +02:00
Tomasz Sobczyk 900f249f59 Reduce the number of accumulator states
Reduce from 3 to 2. Make the intent of the states clearer.

STC: https://tests.stockfishchess.org/tests/view/60c50111457376eb8bcaad03
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 61888 W: 5007 L: 4944 D: 51937
Ptnml(0-2): 164, 3947, 22649, 4030, 154

LTC: https://tests.stockfishchess.org/tests/view/60c52b1c457376eb8bcaad2c
LLR: 2.94 (-2.94,2.94) <-2.50,0.50>
Total: 20248 W: 688 L: 618 D: 18942
Ptnml(0-2): 7, 551, 8946, 605, 15

closes https://github.com/official-stockfish/Stockfish/pull/3548

No functional change.
2021-06-14 11:22:08 +02:00
Guy Vreuls 58307562b6 Revert "Simplify En Passant"
This reverts commit 9f8058bd26.

Fixes the memory leak discussed in pull request #3523
https://github.com/official-stockfish/Stockfish/pull/3523

Passed non-regression STC:
LLR: 2.95 (-2.94,2.94) <-2.50,0.50>
Total: 76184 W: 6330 L: 6282 D: 63572
Ptnml(0-2): 202, 5047, 27564, 5059, 220
https://tests.stockfishchess.org/tests/view/60ba146c457376eb8bcaa2e2

closes https://github.com/official-stockfish/Stockfish/pull/3527

Benched to verify there is no functional change.

Bench: 4364128
2021-06-05 10:47:46 +02:00
Stéphane Nicolet f90274d8ce Small clean-ups
- Comment for Countemove pruning -> Continuation history
- Fix comment in input_slice.h
- Shorter lines in Makefile
- Comment for scale factor
- Fix comment for pinners in see_ge()
- Change Thread.id() signature to size_t
- Trailing space in reprosearch.sh
- Add Douglas Matos Gomes to the AUTHORS file
- Introduce comment for undo_null_move()
- Use Stockfish coding style for export_net()
- Change date in AUTHORS file

closes https://github.com/official-stockfish/Stockfish/pull/3416

No functional change
2021-05-17 10:47:14 +02:00
Tomasz Sobczyk fbbd4adc3c Unify naming convention of the NNUE code
matches the rest of the stockfish code base

closes https://github.com/official-stockfish/Stockfish/pull/3437

No functional change
2021-04-24 12:49:29 +02:00
bmc4 c489df6f5b Simplify King Evasion
Simplify away the removal of some illegal `KING`-evasion moves during move
generation. Verified for correctness by running perft on the following positions:

```
./stockfish
bench 16 1 6 default perft
Nodes searched: 71608931810

./stockfish
position fen 4rrk1/1p1nq3/p7/2p1P1pp/3P2bp/3Q1Bn1/PPPB4/1K2R1NR w - - 40 21
go perft 6
Nodes searched: 6136386434
```

Passed STC:
LLR: 2.94 (-2.94,2.94) {-1.00,0.20}
Total: 16072 W: 1473 L: 1349 D: 13250
Ptnml(0-2): 57, 1047, 5710, 1159, 63
https://tests.stockfishchess.org/tests/view/60629e7ef183b42957b423b1

Passed LTC:
LLR: 2.94 (-2.94,2.94) {-0.70,0.20}
Total: 59064 W: 2214 L: 2177 D: 54673
Ptnml(0-2): 26, 1944, 25556, 1979, 27
https://tests.stockfishchess.org/tests/view/6062dce4f183b42957b423de

closes https://github.com/official-stockfish/Stockfish/pull/3415

No functional change
2021-03-31 07:47:15 +02:00
Guy Vreuls ec42154ef2 Use reference instead of pointer for pop_lsb() signature
This patch changes the pop_lsb() signature from Square pop_lsb(Bitboard*) to
Square pop_lsb(Bitboard&). This is more idomatic for C++ style signatures.

Passed a non-regression STC test:
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 21280 W: 1928 L: 1847 D: 17505
Ptnml(0-2): 71, 1427, 7558, 1518, 66
https://tests.stockfishchess.org/tests/view/6053a1e22433018de7a38e2f

We have verified that the generated binary is identical on gcc-10.

Closes https://github.com/official-stockfish/Stockfish/pull/3404

No functional change.
2021-03-19 20:28:57 +01:00
bmc4 5089061659 Change definition of between_bb()
We remark that in current master, most of our use cases for between_bb() can be
optimized if the second parameter of the function is added to the segment. So we
change the definition of between_bb(s1, s2) such that it excludes s1 but includes s2.

We also use a precomputed array for between_bb() for another small speed gain
(see https://tests.stockfishchess.org/tests/view/604d09f72433018de7a389fb).

Passed STC:
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 18736 W: 1746 L: 1607 D: 15383
Ptnml(0-2): 61, 1226, 6644, 1387, 50
https://tests.stockfishchess.org/tests/view/60428c84ddcba5f0627bb6e4

Yellow LTC:
LTC:
LLR: -3.00 (-2.94,2.94) {0.25,1.25}
Total: 39144 W: 1431 L: 1413 D: 36300
Ptnml(0-2): 13, 1176, 17184, 1178, 21
https://tests.stockfishchess.org/tests/view/605128702433018de7a38ca1

Closes https://github.com/official-stockfish/Stockfish/pull/3397

---------

Verified for correctness by running perft on the following position:

./stockfish
position fen 4rrk1/1p1nq3/p7/2p1P1pp/3P2bp/3Q1Bn1/PPPB4/1K2R1NR w - - 40 21
go perft 6

Nodes searched: 6136386434

--------

No functional change
2021-03-18 00:21:41 +01:00
bmc4 939395729c Introduce least_significant_square_bb()
Introducing least_significant_square_bb(). It is a function that returns a value equal
to square_bb(lsb(bb)), but it uses fewer instruction. It should speed up more on older
processors like armv7-a Clang.

Passed STC:
LLR: 2.93 (-2.94,2.94) {-0.25,1.25}
Total: 213200 W: 19171 L: 18753 D: 175276
Ptnml(0-2): 680, 14513, 75831, 14861, 715
https://tests.stockfishchess.org/tests/view/604bc7632433018de7a38982

Closes https://github.com/official-stockfish/Stockfish/pull/3391

No functional change
2021-03-16 20:54:52 +01:00
Dieter Dobbelaere 7ffae17f85 Add Stockfish namespace.
fixes #3350 and is a small cleanup that might make it easier to use SF
in separate projects, like a NNUE trainer or similar.

closes https://github.com/official-stockfish/Stockfish/pull/3370

No functional change.
2021-03-07 14:26:54 +01:00
Antoine Champion 9b1274aba3 Clean functions returning by const values
The codebase contains multiple functions returning by const-value.
This patch is a small cleanup making those function returns
by value instead, removing the const specifier.

closes https://github.com/official-stockfish/Stockfish/pull/3328

No functional change
2021-03-07 14:05:01 +01:00
Lolligerhans 40cb0f076a Small trivial clean-ups, February 2021
Closes https://github.com/official-stockfish/Stockfish/pull/3329

No functional change
2021-02-16 01:31:42 +01:00
bmc4 9f8058bd26 Simplify En Passant
simplifies the handling of en passant during search, needs a little more care in initialization.

Passed STC:
LLR: 2.95 (-2.94,2.94) {-1.25,0.25}
Total: 72608 W: 6569 L: 6559 D: 59480
Ptnml(0-2): 233, 5117, 25629, 5057, 268
https://tests.stockfishchess.org/tests/view/600f1363735dd7f0f0352ce7

Passed LTC:
LLR: 2.92 (-2.94,2.94) {-0.75,0.25}
Total: 24328 W: 913 L: 864 D: 22551
Ptnml(0-2): 10, 731, 10633, 780, 10
https://tests.stockfishchess.org/tests/view/600f2e93735dd7f0f0352cf6

closes https://github.com/official-stockfish/Stockfish/pull/3330

No functional change.
2021-02-08 21:35:59 +01:00
bmc4 dd96095214 Simplify Chess 960 castling
a little cleanup, and small speedup (about 0.3%) for Chess 960.

Verified with perft on a large set of chess960 positions.

Closes https://github.com/official-stockfish/Stockfish/pull/3317

No functional change
2021-01-31 10:07:02 +01:00
bmc4 befbcffb4e Clean Up Castling in gives_check
There is no need to add rto or kto on the Bitboard which represents the pieces.

STC:
LLR: 2.93 (-2.94,2.94) {-1.25,0.25}
Total: 57064 W: 5096 L: 5067 D: 46901
Ptnml(0-2): 202, 3862, 20355, 3931, 182
https://tests.stockfishchess.org/tests/view/6005ea2c6019e097de3efa55

LTC:
LLR: 2.92 (-2.94,2.94) {-0.75,0.25}
Total: 30088 W: 1094 L: 1052 D: 27942
Ptnml(0-2): 10, 882, 13217, 926, 9
https://tests.stockfishchess.org/tests/view/6006115a6019e097de3efa6e

closes https://github.com/official-stockfish/Stockfish/pull/3311

No functional change.
2021-01-31 10:02:10 +01:00
bmc4 7d0a16e06d Avoid more expensive legality check
speedup of the code, enough to pass STC, failed LTC.

Passed STC:
LLR: 2.93 (-2.94,2.94) {-0.25,1.25}
Total: 68928 W: 6334 L: 6122 D: 56472
Ptnml(0-2): 233, 4701, 24369, 4943, 218
https://tests.stockfishchess.org/tests/view/6002747f6019e097de3ef8dc

Failed LTC:
LLR: -2.96 (-2.94,2.94) {0.25,1.25}
Total: 44560 W: 1702 L: 1675 D: 41183
Ptnml(0-2): 25, 1383, 19438, 1408, 26
https://tests.stockfishchess.org/tests/view/6002a4836019e097de3ef8e3

About 1% speedup:

Result of  50 runs
==================
base (...kfish.master) =    2237500  +/- 7428
test (...ckfish.patch) =    2267003  +/- 7017
diff                   =     +29503  +/- 4774

speedup        = +0.0132
P(speedup > 0) =  1.0000

closes https://github.com/official-stockfish/Stockfish/pull/3304

No functional change.
2021-01-31 10:00:17 +01:00
Lolligerhans 70a818cbd6 Small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/3301

No functional change
2021-01-30 13:27:31 +01:00
Stéphane Nicolet 1188141aa7 Improve play for closed positions
This patch give a small bonus to incite the attacking side to keep more
pawns on the board.

A consequence of this bonus is that Stockfish will tend to play positions
slightly more closed on average than master, especially when it believes
that it has an advantage.

To lower the risk of blockades where Stockfish start shuffling without
progress, we also implement a progressive decrease of the evaluation
value with the 50 moves counter (along with the necessary aging of the
transposition table to reduce the impact of the Graph History Interaction
problem): since the evaluation decreases during shuffling phases, the
engine will tend to examine the consequences of pawn breaks faster during
the search.

Passed STC:
LLR: 2.96 (-2.94,2.94) {-0.25,1.25}
Total: 26184 W: 2406 L: 2252 D: 21526
Ptnml(0-2): 85, 1784, 9223, 1892, 108
https://tests.stockfishchess.org/tests/view/600cc08b735dd7f0f0352c06

Passed LCT:
LLR: 2.95 (-2.94,2.94) {0.25,1.25}
Total: 199768 W: 7695 L: 7191 D: 184882
Ptnml(0-2): 85, 6478, 86269, 6952, 100
https://tests.stockfishchess.org/tests/view/600ccd28735dd7f0f0352c10

Closes https://github.com/official-stockfish/Stockfish/pull/3321

Bench: 3988915
2021-01-30 13:20:56 +01:00
Dieter Dobbelaere 87586b3d0c Use correct chess terms + fix spelling.
- "discovered check" (instead of "discovery check")
  - "en passant" (instead of "en-passant")
  - "pseudo-legal" before a noun (instead of "pseudo legal")
  - "3-fold" (instead of "3fold")

closes https://github.com/official-stockfish/Stockfish/pull/3294

No functional change.
2021-01-11 19:19:39 +01:00
Joost VandeVondele c4d67d77c9 Update copyright years
No functional change
2021-01-08 17:04:23 +01:00
syzygy1 045728a7da Remove piece lists
This patch removes the incrementally updated piece lists from the Position object.

This has been tried before but always failed. My reasons for trying again are:

* 32-bit systems (including phones) are now much less important than they were some years ago (and are absent from fishtest);
* NNUE may have made SF less finely tuned to the order in which moves were generated.

STC:
LLR: 2.94 (-2.94,2.94) {-1.25,0.25}
Total: 55272 W: 5260 L: 5216 D: 44796
Ptnml(0-2): 208, 4147, 18898, 4159, 224
https://tests.stockfishchess.org/tests/view/5fc2986a42a050a89f02c926

LTC:
LLR: 2.96 (-2.94,2.94) {-0.75,0.25}
Total: 16600 W: 673 L: 608 D: 15319
Ptnml(0-2): 14, 533, 7138, 604, 11
https://tests.stockfishchess.org/tests/view/5fc2f98342a050a89f02c95c

closes https://github.com/official-stockfish/Stockfish/pull/3247

Bench: 3940967
2020-11-29 16:51:01 +01:00
Tomasz Sobczyk 3f6451eff7 Manually align arrays on the stack
as a workaround to issues with overaligned alignas() on stack variables in gcc < 9.3 on windows.

closes https://github.com/official-stockfish/Stockfish/pull/3217

fixes #3216

No functional change
2020-11-04 19:52:42 +01:00
syzygy1 2046d5da30 More incremental accumulator updates
This patch was inspired by c065abd which updates the accumulator,
if possible, based on the accumulator of two plies back if
the accumulator of the preceding ply is not available.

With this patch we look back even further in the position history
in an attempt to reduce the number of complete recomputations.
When we find a usable accumulator for the position N plies back,
we also update the accumulator of the position N-1 plies back
because that accumulator is most likely to be helpful later
when evaluating positions in sibling branches.
By not updating all intermediate accumulators immediately,
we avoid doing too much work that is not certain to be useful.
Overall, roughly 2-3% speedup.

This patch makes the code more specific to the net architecture,
changing input features of the net will require additional changes
to the incremental update code as discussed in the PR #3193 and #3191.

Passed STC:
https://tests.stockfishchess.org/tests/view/5f9056712c92c7fe3a8c60d0
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 10040 W: 1116 L: 968 D: 7956
Ptnml(0-2): 42, 722, 3365, 828, 63

closes https://github.com/official-stockfish/Stockfish/pull/3193

No functional change.
2020-10-22 20:50:16 +02:00
syzygy1 fc27d158c0 Bug fix in do_null_move() and NNUE simplification.
This fixes #3108 and removes some NNUE code that is currently not used.

At the moment, do_null_move() copies the accumulator from the previous
state into the new state, which is correct. It then clears the "computed_score"
flag because the side to move has changed, and with the other side to move
NNUE will return a completely different evaluation (normally with changed
sign but also with different NNUE-internal tempo bonus).

The problem is that do_null_move() clears the wrong flag. It clears the
computed_score flag of the old state, not of the new state. It turns out
that this almost never affects the search. For example, fixing it does not
change the current bench (but it does change the previous bench). This is
because the search code usually avoids calling evaluate() after a null move.

This PR corrects do_null_move() by removing the computed_score flag altogether.
The flag is not needed because nnue_evaluate() is never called twice on a position.

This PR also removes some unnecessary {}s and inserts a few blank lines
in the modified NNUE files in line with SF coding style.

Resulf ot STC non-regression test:
LLR: 2.95 (-2.94,2.94) {-1.25,0.25}
Total: 26328 W: 3118 L: 3012 D: 20198
Ptnml(0-2): 126, 2208, 8397, 2300, 133
https://tests.stockfishchess.org/tests/view/5f553ccc2d02727c56b36db1

closes https://github.com/official-stockfish/Stockfish/pull/3109

bench: 4109324
2020-09-08 22:53:17 +02:00
syzygy1 9b4967071e Remove EvalList
This patch removes the EvalList structure from the Position object and generally simplifies the interface between do_move() and the NNUE code.

The NNUE evaluation function first calculates the "accumulator". The accumulator consists of two halves: one for white's perspective, one for black's perspective.

If the "friendly king" has moved or the accumulator for the parent position is not available, the accumulator for this half has to be calculated from scratch. To do this, the NNUE node needs to know the positions and types of all non-king pieces and the position of the friendly king. This information can easily be obtained from the Position object.

If the "friendly king" has not moved, its half of the accumulator can be calculated by incrementally updating the accumulator for the previous position. For this, the NNUE code needs to know which pieces have been added to which squares and which pieces have been removed from which squares. In principle this information can be derived from the Position object and StateInfo struct (in the same way as undo_move() does this). However, it is probably a bit faster to prepare this information in do_move(), so I have kept the DirtyPiece struct. Since the DirtyPiece struct now stores the squares rather than "PieceSquare" indices, there are now at most three "dirty pieces" (previously two). A promotion move that captures a piece removes the capturing pawn and the captured piece from the board (to SQ_NONE) and moves the promoted piece to the promotion square (from SQ_NONE).

An STC test has confirmed a small speedup:

https://tests.stockfishchess.org/tests/view/5f43f06b5089a564a10d850a
LLR: 2.94 (-2.94,2.94) {-0.25,1.25}
Total: 87704 W: 9763 L: 9500 D: 68441
Ptnml(0-2): 426, 6950, 28845, 7197, 434

closes https://github.com/official-stockfish/Stockfish/pull/3068

No functional change
2020-08-26 07:11:26 +02:00
Joost VandeVondele 5f1843c9cb Small trivial cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2801

No functional change
2020-08-23 01:53:41 +02:00
nodchip 84f3e86790 Add NNUE evaluation
This patch ports the efficiently updatable neural network (NNUE) evaluation to Stockfish.

Both the NNUE and the classical evaluations are available, and can be used to
assign a value to a position that is later used in alpha-beta (PVS) search to find the
best move. The classical evaluation computes this value as a function of various chess
concepts, handcrafted by experts, tested and tuned using fishtest. The NNUE evaluation
computes this value with a neural network based on basic inputs. The network is optimized
and trained on the evalutions of millions of positions at moderate search depth.

The NNUE evaluation was first introduced in shogi, and ported to Stockfish afterward.
It can be evaluated efficiently on CPUs, and exploits the fact that only parts
of the neural network need to be updated after a typical chess move.
[The nodchip repository](https://github.com/nodchip/Stockfish) provides additional
tools to train and develop the NNUE networks.

This patch is the result of contributions of various authors, from various communities,
including: nodchip, ynasu87, yaneurao (initial port and NNUE authors), domschl, FireFather,
rqs, xXH4CKST3RXx, tttak, zz4032, joergoster, mstembera, nguyenpham, erbsenzaehler,
dorzechowski, and vondele.

This new evaluation needed various changes to fishtest and the corresponding infrastructure,
for which tomtor, ppigazzini, noobpwnftw, daylen, and vondele are gratefully acknowledged.

The first networks have been provided by gekkehenker and sergiovieri, with the latter
net (nn-97f742aaefcd.nnue) being the current default.

The evaluation function can be selected at run time with the `Use NNUE` (true/false) UCI option,
provided the `EvalFile` option points the the network file (depending on the GUI, with full path).

The performance of the NNUE evaluation relative to the classical evaluation depends somewhat on
the hardware, and is expected to improve quickly, but is currently on > 80 Elo on fishtest:

60000 @ 10+0.1 th 1
https://tests.stockfishchess.org/tests/view/5f28fe6ea5abc164f05e4c4c
ELO: 92.77 +-2.1 (95%) LOS: 100.0%
Total: 60000 W: 24193 L: 8543 D: 27264
Ptnml(0-2): 609, 3850, 9708, 10948, 4885

40000 @ 20+0.2 th 8
https://tests.stockfishchess.org/tests/view/5f290229a5abc164f05e4c58
ELO: 89.47 +-2.0 (95%) LOS: 100.0%
Total: 40000 W: 12756 L: 2677 D: 24567
Ptnml(0-2): 74, 1583, 8550, 7776, 2017

At the same time, the impact on the classical evaluation remains minimal, causing no significant
regression:

sprt @ 10+0.1 th 1
https://tests.stockfishchess.org/tests/view/5f2906a2a5abc164f05e4c5b
LLR: 2.94 (-2.94,2.94) {-6.00,-4.00}
Total: 34936 W: 6502 L: 6825 D: 21609
Ptnml(0-2): 571, 4082, 8434, 3861, 520

sprt @ 60+0.6 th 1
https://tests.stockfishchess.org/tests/view/5f2906cfa5abc164f05e4c5d
LLR: 2.93 (-2.94,2.94) {-6.00,-4.00}
Total: 10088 W: 1232 L: 1265 D: 7591
Ptnml(0-2): 49, 914, 3170, 843, 68

The needed networks can be found at https://tests.stockfishchess.org/nns
It is recommended to use the default one as indicated by the `EvalFile` UCI option.

Guidelines for testing new nets can be found at
https://github.com/glinscott/fishtest/wiki/Creating-my-first-test#nnue-net-tests

Integration has been discussed in various issues:
https://github.com/official-stockfish/Stockfish/issues/2823
https://github.com/official-stockfish/Stockfish/issues/2728

The integration branch will be closed after the merge:
https://github.com/official-stockfish/Stockfish/pull/2825
https://github.com/official-stockfish/Stockfish/tree/nnue-player-wip

closes https://github.com/official-stockfish/Stockfish/pull/2912

This will be an exciting time for computer chess, looking forward to seeing the evolution of
this approach.

Bench: 4746616
2020-08-06 16:37:45 +02:00
Alain SAVARD 76a039027d Clean-up en passant processing
the goal of this PR is to better document how we process
the ep square (if any) given position fen command, and to
output more meaningful (and consistent) debug fen on the "d"
command. The implementation follows
https://en.wikipedia.org/wiki/X-FEN#Encoding_en-passant
following x-fen, it is "valid" to record ep even if ep would put king en prise.

fixes #2784

closes https://github.com/official-stockfish/Stockfish/pull/2797

No functional change
2020-07-09 21:46:26 +02:00
mstembera 547c4a216a Remove old zobrist trick for castling rights
Removes an 8 year old micro optimization aimed at 32-bit architectures
because back then doing an xor of a Key could not be done in one instruction.
See original commit here 821e1c7

STC https://tests.stockfishchess.org/tests/view/5ef5833dde213bf647527d0c
LLR: 2.94 (-2.94,2.94) {-1.50,0.50}
Total: 162648 W: 31053 L: 31097 D: 100498
Ptnml(0-2): 2841, 18966, 37715, 19000, 2802

LTC https://tests.stockfishchess.org/tests/view/5ef7b1bbf993893290cc1489
LLR: 2.93 (-2.94,2.94) {-1.50,0.50}
Total: 62360 W: 7617 L: 7586 D: 47157
Ptnml(0-2): 423, 5662, 18994, 5663, 438

closes https://github.com/official-stockfish/Stockfish/pull/2775

bench: 4591425
2020-06-28 22:00:19 +02:00
Joost VandeVondele ab5cd8340f Small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2756

No functional change
2020-06-24 22:20:04 +02:00
NguyenPham d0cb9b286f show coordinates when displaying board
closes https://github.com/official-stockfish/Stockfish/pull/2723

No functional change
2020-06-09 18:28:20 +02:00
protonspring a5e3b4edde Consolidate all attacks bitboards
This is a non-functional simplification that simplifies getting attacks bitboards.

* consolidates all attacks to attacks_bb (remove Position::attacks_from(..)).
* attacks_bb<PieceType>(square) gets pseudo attacks
* attacks_bb<PieceType>(square, bitboard) gets attacks considering occupied squares in the bitboard).
* pawn_attacks_bb(Color, Square) gets pawn attacks like other pawn attack bitboards.
* Wraps all access to PawnAttacks arrays and PseudoAttacks arrays and adds asserts as appropriate.

Passed STC
LLR: 2.95 (-2.94,2.94) {-1.50,0.50}
Total: 90208 W: 17533 L: 17482 D: 55193
Ptnml(0-2): 1412, 10232, 21798, 10217, 1445
https://tests.stockfishchess.org/tests/view/5ece996275787cc0c05d9790

closes https://github.com/official-stockfish/Stockfish/pull/2703

No functional change
2020-05-30 20:30:31 +02:00
Joost VandeVondele 383b12e1a5 small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2653

No functional change
2020-05-23 13:27:16 +02:00
Joost VandeVondele 353e20674b Small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2628

No functional change
2020-04-29 17:44:24 +02:00
Joost VandeVondele 209e94203f Small cleanups
https://github.com/official-stockfish/Stockfish/pull/2584

No functional change.
2020-03-30 22:46:07 +02:00
Joost VandeVondele ddcbacd04d Small cleanups
closes https://github.com/official-stockfish/Stockfish/pull/2567

No functional change.
2020-03-14 17:04:50 +01:00
Joost VandeVondele 0aee1ec4ab Fix wrong assert.
can trigger an abort when compiling with debug=yes, and using 7men TB.
The assert should check that less than 8 pieces are in the key for each
side, matching the assumption that underlies the FEN string construction.
Also take explicitly care of a 'v' character in material strings.

Fixes an issue reported in the forum:
https://groups.google.com/d/msg/fishcooking/yoVC7etIpz0/7mS7ntZMBAAJ

closes https://github.com/official-stockfish/Stockfish/pull/2547

No functional change.
2020-02-10 09:12:07 +01:00
Joost VandeVondele 0c878adb36 Small cleanups.
closes https://github.com/official-stockfish/Stockfish/pull/2532

Bench: 4869669
2020-02-05 15:32:29 +01:00
protonspring 7a7bcd6359 Simplify signature of remove_piece()
This is a non-functional simplification. Instead of passing the piece type
for remove_piece, we can rely on the board. The only exception is en-passant
which must be explicitly set because the destination square for the capture
is not the same as the piece to remove.

Verified also in the Chess960 castling case by running a couple of perft, see
the pull request discussion: https://github.com/official-stockfish/Stockfish/pull/2460

STC
LLR: 2.94 (-2.94,2.94) [-3.00,1.00]
Total: 18624 W: 4147 L: 4070 D: 10407
Ptnml(0-2): 223, 1933, 4945, 1938, 260
http://tests.stockfishchess.org/tests/view/5dfeaa93e70446e17e451163

No functional change
2020-01-23 17:31:45 +01:00
Stéphane Nicolet 384bff4264 Assorted trivial cleanups January 2020
Assorted trivial cleanups.

No functional change
2020-01-09 21:57:21 +01:00
Alain SAVARD 09bef14c76 Update lists of authors and contributors
Preparing for version 11 of Stockfish: update lists of authors,
contributors giving CPU time to the fishtest framework, etc.

No functional change
2020-01-09 01:43:47 +01:00
Alain SAVARD 83ecfa7c33 Use a faster implementation of Static Exchange Evaluation
SEE (Static Exchange Evaluation) is a critical component, so we might
indulge some tricks to make it faster. Another pull request #2469 showed
some speedup by removing templates, this version uses Ronald de Man
(@syzygy1) SEE implementation which also unrolls the for loop by
suppressing the min_attacker() helper function and exits as soon as
the last swap is conclusive.

See Ronald de Man version there:
https://github.com/syzygy1/Cfish/blob/master/src/position.c

Patch testes against pull request #2469:
LLR: 2.95 (-2.94,2.94) {-1.00,3.00}
Total: 19365 W: 3771 L: 3634 D: 11960
Ptnml(0-2): 241, 1984, 5099, 2092, 255
http://tests.stockfishchess.org/tests/view/5e10eb135e5436dd91b27ba3

And since we are using new SPRT statistics, and that both pull requests
finished with less than 20000 games I also tested against master as
a speed-up:

LLR: 2.99 (-2.94,2.94) {-1.00,3.00}
Total: 18878 W: 3674 L: 3539 D: 11665
Ptnml(0-2): 193, 1999, 4966, 2019, 250
http://tests.stockfishchess.org/tests/view/5e10febf12ef906c8b388745

Non functional change
2020-01-07 11:00:54 +01:00
Stéphane Nicolet e5cfa14f40 Assorted trivial cleanups
No functional change
2019-09-14 08:33:00 +02:00
protonspring 3984b8f8f0 Consolidate CastlingSide and CastlingRights
This is a non-functional simplification that removes CastlingSide and
implements the functionality in CastlingRights (thanks to Jörg Oster
for a comment on the first version of this patch).

STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 53854 W: 12077 L: 12019 D: 29758
http://tests.stockfishchess.org/tests/view/5d517b940ebc5925cf107474

Closes https://github.com/official-stockfish/Stockfish/pull/2265

No functional change
2019-08-23 16:29:29 +02:00
Alain SAVARD 7efc39d683 Assorted trivial cleanups (July 2019)
No functional change
2019-08-14 22:15:48 +02:00
protonspring aec918a2b6 Remove operators for color
This is a non-functional and untested simplification. The increment operator
for color isn't really necessary and seems a bit unnatural to me.

Passed STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 47027 W: 10589 L: 10518 D: 25920
http://tests.stockfishchess.org/tests/view/5d3472d10ebc5925cf0e8d3e

Closes https://github.com/official-stockfish/Stockfish/pull/2247

No functional change
2019-07-26 02:12:23 +02:00
Marco Costalba 4ae5a7b45a Assorted trivial cleanups June 2019
No functional change.
2019-07-11 12:22:20 +02:00
Marco Costalba d39bc2efa1 Assorted trivial cleanups 5/2019
No functional change.

bench: 4178282
2019-06-09 14:57:08 +02:00
svivanov72 2985a6b5d7 Remove unused code (#2150)
Remove an unused operator in has_game_cycle (thanks @vondele)
and modify its comment to explain other code.

No functional change.
2019-05-16 14:14:11 +02:00