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

4777 commits

Author SHA1 Message Date
Stefan Geschwentner
8fec883471 Tweak Late Move Reduction at root
Maintain best move counter at the root and allow there only moves which has a counter
of zero for Late Move Reduction. For compensation only the first three moves are excluded
from Late Move Reduction per default instead the first four moves.

What we can further do:

- here we use a simple counting scheme but perhaps some aging to fade out early iterations
  could be helpful
- use the best move counter also at inner nodes for LMR and/or pruning

STC:
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 17414 W: 3984 L: 3733 D: 9697
http://tests.stockfishchess.org/tests/view/5d6234bb0ebc5939d09f2aa2

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 38058 W: 6448 L: 6166 D: 25444
http://tests.stockfishchess.org/tests/view/5d62681a0ebc5939d09f2f27

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

Bench: 3568210
2019-08-26 08:49:55 +02:00
VoyagerOne
0e295fee25 NMP Tweaks
Tweak again the null move pruning preconditions.

STC:
LLR: 2.96 (-2.94,2.94) [0.50,4.50]
Total: 19675 W: 4430 L: 4169 D: 11076
http://tests.stockfishchess.org/tests/view/5d52bc0e0ebc5925cf108300

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 73895 W: 12496 L: 12114 D: 49285
http://tests.stockfishchess.org/tests/view/5d52dcbc0ebc5925cf108552

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

Bench: 3690065
2019-08-25 11:09:08 +02:00
protonspring
d799529b48 Improve signature of evaluate_shelter()
Remove one parameter in function evaluate_shelter(), making all
comparisons for castled/uncastled shelter locally in do_king_safety().
Also introduce BlockedStorm penalty.

Passed non-regression test at STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 65864 W: 14630 L: 14596 D: 36638
http://tests.stockfishchess.org/tests/view/5d5fc80c0ebc5939d09f0acc

No functional change
2019-08-24 08:21:30 +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
protonspring
a016626825 Simplify futility equation
This is a functional simplification. The 178 constant for the futility equation
in master can be removed.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 42626 W: 9508 L: 9428 D: 23690
http://tests.stockfishchess.org/tests/view/5d5d4e320ebc5925cf11254e

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 26182 W: 4432 L: 4320 D: 17430
http://tests.stockfishchess.org/tests/view/5d5df70d0ebc5925cf112fee

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

Bench: 3985701
2019-08-23 09:37:12 +02:00
Vizvezdenec
10d2ebc6ae Late move reduction, captures and CUT nodes
Expand of Stefan Geschwentner's original idea: we always do LMR for captures at cutnodes.

Passed STC
http://tests.stockfishchess.org/tests/view/5d5b2f8e0ebc5925cf1111b8
LLR: 2.96 (-2.94,2.94) [0.50,4.50]
Total: 36026 W: 8122 L: 7779 D: 20125

Passed LTC
http://tests.stockfishchess.org/tests/view/5d5b40c80ebc5925cf111353
LLR: 3.22 (-2.94,2.94) [0.00,3.50]
Total: 133502 W: 22508 L: 21943 D: 89051

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

Bench: 3494372
2019-08-21 10:47:40 +02:00
protonspring
18279b24fc Tuned Futility Equation
@Vizvezdenec array suggested that alternate values may be better than current
master (see pull request #2270 ). I tuned some linear equations to more closely
represent his values and it passed. These futility values seem quite sensitive,
so perhaps additional Elo improvements can be found here.

STC
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 12257 W: 2820 L: 2595 D: 6842
http://tests.stockfishchess.org/tests/view/5d5b2f360ebc5925cf1111ac

LTC
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 20273 W: 3497 L: 3264 D: 13512
http://tests.stockfishchess.org/tests/view/5d5c0d250ebc5925cf111ac3

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

------------------------------------------
How to continue from there ?

a) we can try a simpler version for the futility margin, this would
   be a simplification :
    margin = 188 * (depth - improving)

b) on the other direction, we can try a complexification by trying
   again to gain Elo with an complete array of futility values.

------------------------------------------

Bench: 4330402
2019-08-21 09:34:46 +02:00
Jean Gauthier
d4dca9187e Slight speep up fetching the endgame table
Replace calls to count(key) + operator[key] with a single call to find(key).
Replace the std::map with std::unordered_map which provide O(1) access,
although the map has a really small number of objects.

Test with [0..4] failed yellow:

TC	10+0.1
SPRT	elo0: 0.00  alpha: 0.05  elo1: 4.00  beta: 0.05
LLR	-2.96 [-2.94,2.94] (rejected)
Elo	1.01 [-0.87,3.08] (95%)
LOS	85.3%
Games	71860 [w:22.3%, l:22.2%, d:55.5%]
http://tests.stockfishchess.org/tests/view/5d5432210ebc5925cf109d61

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

No functional change
2019-08-21 09:11:17 +02:00
Alain SAVARD
7efc39d683 Assorted trivial cleanups (July 2019)
No functional change
2019-08-14 22:15:48 +02:00
Stefan Geschwentner
66a3c2968b Tweak unsafe checks
Remove mobility area for unsafe checks. Also separate the evaluation terms
for unsafe checks and blockers for king with adjusted weights.

STC:
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 124526 W: 28292 L: 27504 D: 68730
http://tests.stockfishchess.org/tests/view/5d5138290ebc5925cf1070c3

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 84968 W: 14499 L: 14083 D: 56386
http://tests.stockfishchess.org/tests/view/5d527cfa0ebc5925cf107f93

Bench: 4139590
2019-08-14 20:59:04 +02:00
joergoster
fcee0ce6a3 Revert "Improve multiPV mode"
This reverts commit a8de07cc26.
2019-08-01 09:28:34 +02:00
xoto10
8152a74ab4 Tune search constants
This is the result of a 200k tuning run at LTC:
http://tests.stockfishchess.org/tests/view/5d3576b70ebc5925cf0e9e1e

which passed quickly at LTC:
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 12954 W: 2280 L: 2074 D: 8600
http://tests.stockfishchess.org/tests/view/5d3ff3f70ebc5925cf0f87a2

STC failed, but second LTC at [0,4] passed easily:
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 8004 W: 1432 L: 1252 D: 5320
http://tests.stockfishchess.org/tests/view/5d407cff0ebc5925cf0f9119

Further work?
No doubt some of these changes produce most of the gain and some are neutral
or even bad, so further testing on individual/groups of parameters changed
here might show more gains. It does look like these tests might need to be
at LTC though, so maybe not too practical to do. See the thread in the pull
request for an interesting discussion:
https://github.com/official-stockfish/Stockfish/pull/2260

Bench: 4024328
2019-07-31 09:35:20 +02:00
protonspring
d980d7c0d4 Simplify weak lever
STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 14844 W: 3347 L: 3212 D: 8285
http://tests.stockfishchess.org/tests/view/5d3a2d7b0ebc5925cf0f1632

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 55261 W: 9374 L: 9309 D: 36578
http://tests.stockfishchess.org/tests/view/5d3a3d9e0ebc5925cf0f1786

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

bench: 3484124
2019-07-28 19:48:57 +02:00
mstembera
9d3a2ecaa2 Bug fix: always choose shortest mate in multithread mode
In current master, with the voting scheme the best thread selection may
pick a non mate or not the shortest mate thread. This patch fixes this bug.
Formatting suggestion by Jörg Oster.

Related past pull requests:
https://github.com/official-stockfish/Stockfish/pull/1074
https://github.com/official-stockfish/Stockfish/pull/1215

Passed a [-4..0] verification test with 3 threads:
LLR: 2.95 (-2.94,2.94) [-4.00,0.00]
Total: 57158 W: 11374 L: 11424 D: 34360
http://tests.stockfishchess.org/tests/view/5d22deb30ebc5925cf0caefd

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

No functional change (in single threaded mode)

----------------------------------------------------

Comment by Jörg Oster

Just one sample output to demonstrate the effect of this patch.
5 Threads, 1 GB Hash

 +---+---+---+---+---+---+---+---+
 | r |   | b |   |   | r | k |   |
 +---+---+---+---+---+---+---+---+
 |   |   |   | n |   | p | b |   |
 +---+---+---+---+---+---+---+---+
 |   |   | p |   | p |   | p |   |
 +---+---+---+---+---+---+---+---+
 | p |   |   |   |   |   | P |   |
 +---+---+---+---+---+---+---+---+
 | P | p |   |   | B |   | N | Q |
 +---+---+---+---+---+---+---+---+
 |   | q |   |   |   |   | P |   |
 +---+---+---+---+---+---+---+---+
 |   |   | R |   |   | P |   |   |
 +---+---+---+---+---+---+---+---+
 |   |   |   | R |   |   | K |   |
 +---+---+---+---+---+---+---+---+

Fen: r1b2rk1/3n1pb1/2p1p1p1/p5P1/Pp2B1NQ/1q4P1/2R2P2/3R2K1 w - - 8 34
Key: 38B4CA1067D4F477
Checkers:
ucinewgame
isready
readyok
go mate 17 searchmoves d1d7
info depth 65 seldepth 36 multipv 1 score mate 18 nodes 785875935 nps 8650448 hashfull 1000 tbhits 0 time 90848 pv d1d7 c8d7 g4f6 g7f6 g5f6 b3a3 g1g2 a3a1 h4g5 a1f6 g5f6 e6e5 c2c1 d7h3 g2h3 a8a6 h3g2 c6c5 f6a6 g8g7 c1c5 f7f6 a6e6 f8f7 c5c8 f6f5 e4d5 g7h6 e6f7 f5f4 f7e7 f4f3 d5f3 b4b3 c8h8
info depth 63 seldepth 36 multipv 1 score mate 17 nodes 785875935 nps 8650448 hashfull 1000 tbhits 0 time 90848 pv d1d7 c8d7 g4f6 g7f6 g5f6 b3a3 g1g2 a3a1 h4g5 a1f6 g5f6 e6e5 c2c1 d7h3 g2h3 a8a6 c1d1 b4b3 h3g2 c6c5 f6a6 g8g7 d1d7 g7g8 a6f6 b3b2 e4g6 b2b1q g6f7 f8f7 f6f7 g8h8 f7g7
bestmove d1d7 ponder c8d7
2019-07-26 03:33:32 +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
Vizvezdenec
acdda38b93 Tweak of SEE pruning condition
passed STC
http://tests.stockfishchess.org/tests/view/5d386bda0ebc5925cf0ef49a
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 56874 W: 12820 L: 12373 D: 31681

passed LTC
http://tests.stockfishchess.org/tests/view/5d38873a0ebc5925cf0ef86e
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 43512 W: 7547 L: 7247 D: 28718

Additional thanks to @locutus2 , @miguel-l and @xoto10 for fruitful discussion.
There may be some more elo there since this tweak was the first one and numbers
are more or less arbitrary.

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

Bench 3935523
2019-07-25 09:16:53 +02:00
Alain SAVARD
33c3a04653 Pawn clean up
Non functional simplification when we find the passed pawns in pawn.cpp
and some code clean up. It also better follows the pattern "flag the pawn"
and "score the pawn".

-------------------------

The idea behind the third condition for candidate passed pawn is a little
bit difficult to visualize. Just for the record, the idea is the following:

Consider White e5 d4 against black e6. d4 can (in some endgames) push
to d5 and lever e6. Thanks to this sacrifice, or after d5xe6, we consider
e5 as "passed".

However:
- if White e5/d4 against black e6/c6: d4 cannot safely push to d5 since d5 is double attacked;
- if White e5/d4 against black e6/d5: d4 cannot safely push to d5 since it is occupied.

This is exactly what the following expression does:

```
   && (shift<Up>(support) & ~(theirPawns | dblAttackThem)))
```

--------------------------

http://tests.stockfishchess.org/tests/view/5d3325bb0ebc5925cf0e6e91
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 124666 W: 27586 L: 27669 D: 69411

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

No functional change
2019-07-25 09:05:08 +02:00
VoyagerOne
dc243a3c88 LMR Tweak
Reset statScore to zero if negative and most stats shows >= 0

STC:
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 23097 W: 5242 L: 4963 D: 12892
http://tests.stockfishchess.org/tests/view/5d31dd650ebc5925cf0e598f

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 227597 W: 39013 L: 38191 D: 150393
http://tests.stockfishchess.org/tests/view/5d31fcdf0ebc5925cf0e5c13

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

Bench: 3242229
2019-07-25 08:46:26 +02:00
Alain SAVARD
9dc57b660e Passed file cleanup
Protonspring had a successful functional simplification that removes the
PassedFile array using a simple linear equation.

Merge the additive term S(5, 10) of protonspring passed file simplification
(pull request https://github.com/official-stockfish/Stockfish/pull/2250)
into the PassedRank array. This harmless change has a different bench because
the candidate passer evaluation will always get less compared to #2250,
as we apply bonus = bonus /2.

Tested as a non-regression against #2250

Passed STC
http://tests.stockfishchess.org/tests/view/5d33427e0ebc5925cf0e6fa2
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 81459 W: 18174 L: 18171 D: 45114

Passed LTC
http://tests.stockfishchess.org/tests/view/5d335c8d0ebc5925cf0e731e
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 18525 W: 3176 L: 3052 D: 12297

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

Bench: 3859856
2019-07-25 08:32:49 +02:00
Lolligerhans
fd96cba676 No influence on unsafeSquares of passers by pieces
Remove their pieces from influencing 'unsafeSquares' in passer
evaluation.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 36421 W: 8170 L: 8078 D: 20173
http://tests.stockfishchess.org/tests/view/5d22fc8e0ebc5925cf0cb26e

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 18927 W: 3253 L: 3129 D: 12545
http://tests.stockfishchess.org/tests/view/5d26e2b20ebc5925cf0d3218

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

Bench: 3285659
2019-07-25 08:23:43 +02:00
Vizvezdenec
19509e5f13 Tweak LMR and killers
Give extra stat bonus/malus in case of LMR for killers.

passed STC
http://tests.stockfishchess.org/tests/view/5d2c8e760ebc5925cf0dcf23
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 67188 W: 15030 L: 14534 D: 37624

passed LTC
http://tests.stockfishchess.org/tests/view/5d2d0ce40ebc5925cf0de115
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 144355 W: 24739 L: 24153 D: 95463

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

bench 3723147
2019-07-25 08:17:11 +02:00
Alain SAVARD
3ec362e4b2 Space Invaders
Try a more ambitius simplification of the space bonus

STC http://tests.stockfishchess.org/tests/view/5d2b62c90ebc5925cf0da2a4
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 51299 W: 11320 L: 11257 D: 28722

LTC http://tests.stockfishchess.org/tests/view/5d2bac270ebc5925cf0db215
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 49761 W: 8409 L: 8335 D: 33017

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

bench: 3395999
2019-07-25 08:07:55 +02:00
Marco Costalba
7090d2561a Fix bench
Bench: 3357457
2019-07-14 15:21:08 +02:00
Joost VandeVondele
0dbc72d82e UCI_Elo implementation (#2225)
This exploits the recent fractional Skill Level, and is a result from some discussion in #2221 and the older #758.

Basically, if UCI_LimitStrength is set, it will internally convert UCI_Elo to a matching fractional Skill Level.
The Elo estimate is based on games at  TC 60+0.6, Hash 64Mb, 8moves_v3.pgn, rated with Ordo, anchored to goldfish1.13 (CCRL 40/4 ~2000).
Note that this is mostly about internal consistency, the anchoring to CCRL is a bit weak, e.g. within this tournament,
goldfish and sungorus only have a 200Elo difference, their rating difference on CCRL is 300Elo.

I propose that we continue to expose 'Skill Level' as an UCI option, for backwards compatibility.

The result of a tournament under those conditions are given by the following table, where the player name reflects the UCI_Elo.

   # PLAYER          :  RATING  ERROR  POINTS  PLAYED   (%)  CFS(%)
   1 Elo2837         :  2792.2   50.8   536.5     711    75     100
   2 Elo2745         :  2739.0   49.0   487.5     711    69     100
   3 Elo2654         :  2666.4   49.2   418.0     711    59     100
   4 Elo2562         :  2604.5   38.5   894.5    1383    65     100
   5 Elo2471         :  2515.2   38.1   651.5     924    71     100
   6 Elo2380         :  2365.9   35.4   478.5     924    52     100
   7 Elo2289         :  2290.0   28.0   864.0    1596    54     100
   8 sungorus1.4     :  2204.9   27.8   680.5    1596    43      60
   9 Elo2197         :  2201.1   30.1   523.5     924    57     100
  10 Elo2106         :  2103.8   24.5   730.5    1428    51     100
  11 Elo2014         :  2030.5   30.3   377.5     756    50      98
  12 goldfish1.13    :  2000.0   ----   511.0    1428    36     100
  13 Elo1923         :  1928.5   30.9   641.5    1260    51     100
  14 Elo1831         :  1829.0   42.1   370.5     756    49     100
  15 Elo1740         :  1738.3   42.9   277.5     756    37     100
  16 Elo1649         :  1625.0   42.1   525.5    1260    42     100
  17 Elo1558         :  1521.5   49.9   298.0     756    39     100
  18 Elo1467         :  1471.3   51.3   246.5     756    33     100
  19 Elo1375         :  1407.1   51.9   183.0     756    24     ---

It can be observed that all set Elos correspond within the error bars with the observed Ordo rating.

No functional change
2019-07-14 14:47:50 +02:00
protonspring
650aeaf242 Remove std::pow from reduction. (#2234)
This is a functional simplification that removes the std::pow from reduction. The resulting reduction values are within 1% of master.

This is a simplification because i believe an fp addition and multiplication is much faster than a call to std::pow() which is historically slow and performance varies widely on different architectures.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 23471 W: 5245 L: 5127 D: 13099
http://tests.stockfishchess.org/tests/view/5d27ac1b0ebc5925cf0d476b

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 51533 W: 8736 L: 8665 D: 34132
http://tests.stockfishchess.org/tests/view/5d27b74e0ebc5925cf0d493c

Bench 3765158
2019-07-14 14:46:10 +02:00
31m059
13ba67801f Just blockSq, not forward file. Bench: 3377831 (#2240)
This is another functional simplification to Stockfish passed pawn evaluation.

Stockfish evaluates some pawns which are not yet passed as "candidate" passed pawns, which are given half the bonus of fully passed ones. Prior to this commit, Stockfish considered a passed pawn to be a "candidate" if (a) it would not be a passed pawn if moved one square forward (the blocking square), or (b) there were other pawns (of either color) in front of it on the file. This latter condition used a fairly complicated method, forward_file_bb; here, rather than inspect the entire forward file, we simply re-use the blocking square. As a result, some pawns previously considered "candidates", but which are able to push forward, no longer have their bonus halved.

Simplification tests passed quickly at both STC and LTC. The results from both tests imply that this simplification is, most likely, additionally a small Elo gain, with a LTC likelihood of superiority of 87 percent.

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 12908 W: 2909 L: 2770 D: 7229
http://tests.stockfishchess.org/tests/view/5d2a1c880ebc5925cf0d9006

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 20723 W: 3591 L: 3470 D: 13662
http://tests.stockfishchess.org/tests/view/5d2a21fd0ebc5925cf0d9118

Bench: 3377831
2019-07-14 14:42:30 +02:00
Michael Chaly
0a8a3b8d9c tviigg. (#2238)
Current master code made sence when we had 2 types of bonuses for protected path to queen. But it was simplified so we have only one bonus now and code was never cleaned.
This non-functional simplification removes useless defendedsquares bitboard and removes one bitboard assignment (defendedSquares &= attackedBy[Us][ALL_PIECES] + defendedSquares & blockSq becomes just attackedBy[Us][ALL_PIECES] & blockSq also we never assign defendedSquares = squaresToQueen because we don't need it).
So should be small non-functional speedup.
Passed simplification SPRT.
http://tests.stockfishchess.org/tests/view/5d2966ef0ebc5925cf0d7659
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 23319 W: 5152 L: 5034 D: 13133

bench 3361902
2019-07-14 14:41:28 +02:00
31m059
a0360cc2d4 Linear formula for w. Bench: 3328507 (#2239)
In Stockfish, both the middlegame and endgame bonus for a passed pawn are calculated as a product of two factors. The first is k, chosen based on the presence of defended and unsafe squares. The second is w, a quadratic function of the pawn's rank. Both are only applied if the pawn's relative rank is at least RANK_4.

It does not appear that the complexity of a quadratic function is necessary for w. Here, we replace it with a simpler linear one, which performs equally at both STC and LTC.

STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 46814 W: 10386 L: 10314 D: 26114
http://tests.stockfishchess.org/tests/view/5d29686e0ebc5925cf0d76a1

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 82372 W: 13845 L: 13823 D: 54704
http://tests.stockfishchess.org/tests/view/5d2980650ebc5925cf0d7bfd

Bench: 3328507
2019-07-14 14:40:45 +02:00
Stefan Geschwentner
ff69d570d7 Full bonus for LMR stats update
Simplify previous commit by using the full bonus for LMR-triggered stats update.

STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 23684 W: 5255 L: 5137 D: 13292
http://tests.stockfishchess.org/tests/view/5d2826660ebc5925cf0d5180

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 16245 W: 2832 L: 2704 D: 10709
http://tests.stockfishchess.org/tests/view/5d282e9c0ebc5925cf0d529b

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

Bench: 3361902
2019-07-13 05:49:14 +02:00
Stefan Geschwentner
389e60741f Late Move reduction and continuation history
Update continuation history after LMR-triggered full depth research.
Directly after a LMR-triggered full depth research, we update the
continuation history for quiet moves (but with only half stat bonus).

STC:
LLR: 2.96 (-2.94,2.94) [0.50,4.50]
Total: 39657 W: 8966 L: 8604 D: 22087
http://tests.stockfishchess.org/tests/view/5d279fa40ebc5925cf0d4566

LTC:
LLR: 2.96 (-2.94,2.94) [0.50,3.50]
Total: 32582 W: 5740 L: 5427 D: 21415
http://tests.stockfishchess.org/tests/view/5d27dbf90ebc5925cf0d4b7e

Bench: 3239357
2019-07-12 09:26:45 +02:00
31m059
82d66f6b72 Exclude passed pawns from Attacked2Unsupported
We recently added a bonus for double pawn attacks on unsupported enemy pawns,
on June 27. However, it is possible that the unsupported pawn may become a passer
by simply pushing forward out of the double attack. By rewarding double attacks,
we may inadvertently reward the creation of enemy passers, by encouraging both of
our would-be stoppers to attack the enemy pawn even if there is no opposing
friendly pawn on the same file.

Here, we revise this term to exclude passed pawns. In order to simplify the code
with this change included, we non-functionally rewrite Attacked2Unsupported to
be a penalty for enemy attacks on friendly pawns, rather than a bonus for our
attacks on enemy pawns. This allows us to exclude passed pawns with a simple
& ~e->passedPawns[Us], while passedPawns[Them] is not yet defined in this part
of the code.

This dramatically reduces the proportion of positions in which Attacked2Unsupported
is applied, to about a third of the original. To compensate, maintaining the same
average effect across our bench positions, we nearly triple Attacked2Unsupported
from S(0, 20) to S(0, 56). Although this pawn formation is rare, it is worth more
than half a pawn in the endgame!

STC: (stopped automatically by fishtest after 250,000 games)
LLR: -0.87 (-2.94,2.94) [0.50,4.50]
Total: 250000 W: 56585 L: 55383 D: 138032
http://tests.stockfishchess.org/tests/view/5d25795e0ebc5925cf0cfb51

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 81038 W: 13965 L: 13558 D: 53515
http://tests.stockfishchess.org/tests/view/5d25f3920ebc5925cf0d10dd

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

Bench: 3765158
2019-07-11 23:05:28 +02:00
Marco Costalba
4ae5a7b45a Assorted trivial cleanups June 2019
No functional change.
2019-07-11 12:22:20 +02:00
VoyagerOne
c83cbe42f3 Tweak capture scoring formula
STC:
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 20556 W: 4685 L: 4438 D: 11433
http://tests.stockfishchess.org/tests/view/5d25d26e0ebc5925cf0d0b4a

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 14856 W: 2649 L: 2446 D: 9761
http://tests.stockfishchess.org/tests/view/5d25d8b20ebc5925cf0d0c6d

bench: 3206912
2019-07-11 11:59:36 +02:00
xoto10
5a7827d59d Combo of statscore divisor and pawn psqt changes
Passed STC 10+0.1 th 1:
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 13282 W: 3100 L: 2881 D: 7301
http://tests.stockfishchess.org/tests/view/5d21132e0ebc5925cf0c81f4

Passed LTC 60+0.6 th 1:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 44243 W: 7768 L: 7468 D: 29007
http://tests.stockfishchess.org/tests/view/5d2119050ebc5925cf0c832b

Bench 3705891
2019-07-11 11:51:27 +02:00
protonspring
93349d0dbd Use score instead of array to evaluate shelter
This is a non-functional simplification. Instead of an array of values, just use a Score.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 16309 W: 3673 L: 3541 D: 9095
http://tests.stockfishchess.org/tests/view/5d24f3b80ebc5925cf0ceb5b

No functional change
2019-07-11 11:42:08 +02:00
Daniel Axtens
fa1a2a0667 Enable popcount and prefetch for ppc-64
PowerPC has had popcount instructions for a long time, at least as far
back as POWER5 (released 2004). Enable them via a gcc builtin.

Using a gcc builtin has the added bonus that if compiled for a processor
that lacks a hardware instruction, gcc will include a software popcount
implementation that does not use the instruction. It might be slower
than the table lookups (or it might be faster) but it will certainly work.
So this isn't going to break anything.

On my POWER8 VM, this leads to a ~4.27% speedup.

Fir prefetch, the gcc builtin generates a 'dcbt' instruction, which is
supported at least as far back as the G5 (2002) and POWER4 (2001).

This leads to a ~5% speedup on my POWER8 VM.

No functional change
2019-07-11 11:30:09 +02:00
Joost VandeVondele
ca51d1ee63 Smoothly change playing strength with skill level. (#2142)
The current skill levels (1-20) allow for adjusting playing strengths, but
do so in big steps (e.g. level 10 vs level 11 is a ~143 Elo jump at STC).
Since the 'Skill Level' input can already be a floating point number, this
patch uses the fractional part of the input to provide the user with
fine control, allowing for varying the playing strength essentially
continuously.

The implementation internally still uses integer skill levels (needed since they pick Depths),
but non-deterministically rounds up or down the used skill level such that the average integer
skill corresponds to the input floating point one. As expected, intermediate
(fractional) skill levels yield intermediate playing strenghts.

Tested at STC, playing level 10 against levels between 10 and 11 for 10000 games

level 10.25 ELO:  24.26 +-6.2
level 10.5  ELO:  67.51 +-6.3
level 10.75 ELO:  98.52 +-6.4
level 11    ELO: 143.65 +-6.7

http://tests.stockfishchess.org/tests/view/5cd9c6b40ebc5925cf056791
http://tests.stockfishchess.org/tests/view/5cd9d22b0ebc5925cf056989
http://tests.stockfishchess.org/tests/view/5cd9cf610ebc5925cf056906
http://tests.stockfishchess.org/tests/view/5cd9d2490ebc5925cf05698e

No functional change.
2019-07-01 14:07:54 +02:00
Joost VandeVondele
217840a6a5 Introduce coordination between searching threads (#2204)
this patch improves threading performance by introducing some coordination between threads.

The observation is that threading is an area where a lot of Elo can potentially be gained:
https://github.com/glinscott/fishtest/wiki/UsefulData#elo-from-threading
At STC, 8 threads gain roughly 320 Elo, vs sequential at the same time,
however, loses 66 Elo against a single thread with 8x more time.
This 66 Elo should be partially recoverable with improved threading.

To improve threading, this patch introduces some LMR at nodes that are already being searched by other threads.
This requires some coordination between threads, avoiding however synchronisation.
To do so, threads leave a trail of breadcrumbs to mark the nodes they are searching.
These breadcrumbs are stored in a small hash table, which is only probed at low plies (currently ply < 8).

A couple of variants of this patch passed both STC and LTC threaded tests.
I picked the simpler, more robust version.
I expect that further tests can find further improvements.

STC (5+0.05 @ 8 threads):
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 26209 W: 5359 L: 5079 D: 15771
http://tests.stockfishchess.org/tests/view/5d0a9b030ebc5925cf0a8e6f

LTC (20+0.2 @ 8 threads):
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 34832 W: 5650 L: 5382 D: 23800
http://tests.stockfishchess.org/tests/view/5d0c67a20ebc5925cf0aafa7

other passed/tested variants:
http://tests.stockfishchess.org/tests/view/5d0a9b030ebc5925cf0a8e6f
http://tests.stockfishchess.org/tests/view/5d0c67ca0ebc5925cf0aafa9
http://tests.stockfishchess.org/tests/view/5d0c67810ebc5925cf0aafa3
http://tests.stockfishchess.org/tests/view/5d0958ca0ebc5925cf0a74c6

For the sequential code there is no change in bench, and an earlier version of this patch passed a non-regression test.
STC (10+0.1 @ 1 thread)
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 10471 W: 2364 L: 2220 D: 5887
http://tests.stockfishchess.org/tests/view/5d087ee20ebc5925cf0a6381

passed the additional non-regression tests at 2 and 4 threads 20+0.2 TC. The code was rebased on master prior to testing.

2 threads:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 218863 W: 40927 L: 41153 D: 136783
http://tests.stockfishchess.org/tests/view/5d18c6c30ebc5925cf0b9566

4threads:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 16839 W: 3017 L: 2889 D: 10933
http://tests.stockfishchess.org/tests/view/5d18c6ea0ebc5925cf0b9568

No functional change.
2019-07-01 14:07:23 +02:00
protonspring
79d06d8840 Move storm special condition to UnblockedStorm array (#2210)
This is a functional simplification.

Looks like we can accommodate the special initialization of Value in evaluate_shelter in the UnblockedStorm array.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 32483 W: 7422 L: 7322 D: 17739
http://tests.stockfishchess.org/tests/view/5d14c5f80ebc5925cf0b48da

LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 35361 W: 6139 L: 6042 D: 23180
http://tests.stockfishchess.org/tests/view/5d14d69c0ebc5925cf0b4bd0

Bench 3596270
2019-06-30 15:22:37 +02:00
Jörg Oster
c9d73d1aa5 Try to get a more precise bench time (#2211)
Initialization of larger hash sizes can take some time.
Don't include this time in the bench by resetting the timer after Search::clear().
Also move 'ucinewgame' command down in the list, so that it is processed
after the configuration of Threads and Hash size.

No functional change.
2019-06-30 15:16:20 +02:00
protonspring
d889bb4718 Bonus for double attacks on unsupported pawns
This is a functional change that rewards double attacks on an unsupported pawns.

STC (non-functional difference)
LLR: 2.96 (-2.94,2.94) [0.50,4.50]
Total: 83276 W: 18981 L: 18398 D: 45897
http://tests.stockfishchess.org/tests/view/5d0970500ebc5925cf0a77d4

LTC (incomplete looping version)
LLR: 0.50 (-2.94,2.94) [0.00,3.50]
Total: 82999 W: 14244 L: 13978 D: 54777
http://tests.stockfishchess.org/tests/view/5d0a8d480ebc5925cf0a8d58

LTC (completed non-looping version).
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 223381 W: 38323 L: 37512 D: 147546
http://tests.stockfishchess.org/tests/view/5d0e80510ebc5925cf0ad320

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

Bench 3633546

----------------------------------

Comments by Alain SAVARD:

interesting result ! I would have expected that search would resolve such positions
correctly on the very next move. This is not a very common pattern, and when it happens,
it will quickly disappear. So I'm quite surprised that it passed LTC.
I would be even more surprised if this would resist a simplification.

Anyway, let's try to imagine a few cases.

a) If you have White d5 f5 against Black e6, and White to move
last move by Black was probably a capture on e6 and White is about to recapture on e6

b) If you have White d5 f5 against e6, and Black to move
last move by White was possibly a capture on d5 or f5
or the pawn on e6 was pinned or could not move for some reason.
and white wants to blast open the position and just pushed d4-d5 or f4-f5

Some possible follow-ups
a) Motif is so rare that the popcount() can be safely replaced with a bool()
But this would not pass a SPRT[0,4],
So try a simplification with bool() and also without the & ~theirAttacks

b) If it works, we probably can simply have this in the loop
if (lever) score += S(0, 20);

c) remove all this and tweak something in search for pawn captures (priority, SEE, extension,..)
2019-06-27 09:46:36 +02:00
Vizvezdenec
dab66631e8 Introduce attacks on space area
This patch introduces a small malus for every square in our space mask
that is attacked by enemy. The value of the malus is completely arbitrary
and is something we can tweak, also maybe we can gain some elo with tweaking
space threshold after this addition.

Passed STC
http://tests.stockfishchess.org/tests/view/5d10ce590ebc5925cf0af30b
LLR: 2.96 (-2.94,2.94) [0.50,4.50]
Total: 7082 W: 1648 L: 1449 D: 3985

Passed LTC
http://tests.stockfishchess.org/tests/view/5d10d2d80ebc5925cf0af3fd
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 79494 W: 13727 L: 13324 D: 52443

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

bench 3516460
2019-06-27 09:26:08 +02:00
Sergei Ivanov
8b4521df83 Do not define increment operators on Value, Depth and Direction
These operators are never used and do not make sense for these types.

No functional change.
2019-06-27 09:05:03 +02:00
joergoster
a8de07cc26 Improve multiPV mode
Skip all moves during the Non-PV (zero-window) search which will be
searched as PV moves later anyways. We also wake sure the moves will
be reported to the GUI despite they're not being searched — some GUIs
may get confused otherwise, and it would unnecessarily complicate the
code.

Tested with MultiPV=4
STC
http://tests.stockfishchess.org/tests/view/5ce7137c0ebc5925cf070d69
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 8233 W: 3708 L: 3424 D: 1101

LTC
http://tests.stockfishchess.org/tests/view/5ce798d60ebc5925cf071d17
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 7369 W: 3197 L: 2911 D: 1261

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

No functional change. (in single PV mode)
2019-06-27 08:57:59 +02:00
Joost VandeVondele
4c986b0501 Make the debug counters thread safe.
needed to use them in a threaded run.

No functional change.
2019-06-22 09:57:07 +02:00
Vizvezdenec
7cb8817ef2 Rewrite "More bonus for free passed pawn"
-removes wideUnsafeSquares bitboard
-removes a couple of bitboard operations
-removes one if operator
-updates comments so they actually represent what this part of code is doing now.

passed non-regression STC
http://tests.stockfishchess.org/tests/view/5d0c1ae50ebc5925cf0aa8db
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 16892 W: 3865 L: 3733 D: 9294

No functional change
2019-06-21 10:05:50 +02:00
Vizvezdenec
37ffacf209 More bonus for free passed pawn
Give even more bonus to passed pawn if adjacent squares to its path
are not attacked.

passed STC
http://tests.stockfishchess.org/tests/view/5d08c9b10ebc5925cf0a6630
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 175197 W: 39859 L: 38816 D: 96522

passed LTC
http://tests.stockfishchess.org/tests/view/5d0ab8240ebc5925cf0a8fe4
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 92928 W: 16124 L: 15682 D: 61122

Bench: 3398333
2019-06-20 16:52:02 +02:00
Miguel Lahoz
8bf21a723e Change multi-cut pruning condition
Use comparison of eval with beta to predict potential cutNodes. This
allows multi-cut pruning to also prune possibly mislabeled Pv and NonPv
nodes.

STC:
LLR: 2.95 (-2.94,2.94) [0.50,4.50]
Total: 54305 W: 12302 L: 11867 D: 30136
http://tests.stockfishchess.org/tests/view/5d048ba50ebc5925cf0a15e8

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,3.50]
Total: 189512 W: 32620 L: 31904 D: 124988
http://tests.stockfishchess.org/tests/view/5d04bf740ebc5925cf0a17f0

Normally I would think such changes are risky, specially for PvNodes,
but after trying a few other versions, it seems this version is more
sound than I initially thought.

Aside from this, a small funtional change is made to return
singularBeta instead of beta to be more consistent with the fail-soft
logic used in other parts of search.

=============================

How to continue from there ?

We could try to audit other parts of the search where the "cutNode"
variable is used, and try to use dynamic info based on heuristic
eval rather than on this variable, to check if the idea behind this
patch could also be applied successfuly.

Bench: 3503788
2019-06-20 16:39:22 +02:00
VoyagerOne
297c40291a QuietPick Speed-up
Non-functional speedup: no need to generate, score, or sort quiet moves
if SkipQuiet is true. Thanks to @mstembera for his suggestion.

STC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 27910 W: 6406 L: 6129 D: 15375
http://tests.stockfishchess.org/tests/view/5d07e0920ebc5925cf0a58a8

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

No functional change
2019-06-20 16:22:45 +02:00
Joost VandeVondele
59f1d0c7dd Fix progress issue with shuffling extensions
Fixes issues #2126 and #2189 where no progress in rootDepth is made for particular fens:

8/8/3P3k/8/1p6/8/1P6/1K3n2 b - - 0 1
8/1r1rp1k1/1b1pPp2/2pP1Pp1/1pP3Pp/pP5P/P5K1/8 w - - 79 46

the cause are the shuffle extensions. Upon closer analysis, it appears that in these cases a shuffle extension is made for every node searched, and progess can not be made. This patch implements a fix, namely to limit the number of extensions relative to the number of nodes searched. The ratio employed is 1/4, which fixes the issues seen so far, but it is a heuristic, and I expect that certain positions might require an even smaller fraction.

The patch was tested as a bug fix and passed:

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 56601 W: 12633 L: 12581 D: 31387
http://tests.stockfishchess.org/tests/view/5d02b37a0ebc5925cf09f6da

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 52042 W: 8907 L: 8837 D: 34298
http://tests.stockfishchess.org/tests/view/5d0319420ebc5925cf09fe57

Furthermore, to confirm that the shuffle extension in this form indeed still brings Elo, one more test at VLTC was performed:
VLTC:
LLR: 2.96 (-2.94,2.94) [0.00,3.50]
Total: 142022 W: 20963 L: 20435 D: 100624
http://tests.stockfishchess.org/tests/view/5d03630d0ebc5925cf0a011a

Bench: 3961247
2019-06-20 16:15:57 +02:00