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

3982 commits

Author SHA1 Message Date
Alain SAVARD
243a9f5484 Reformat eval_init()
Move more code into eval_init, removing some
clutter in the main routine.

Write eval_init only from "our" point of view
(do not init the attackedBy[Them] bitboards).

Add mobilityArea to the evalinfo

A few edits while being there

tested for non-regression at STC
http://tests.stockfishchess.org/tests/view/587fab230ebc5915193f77d9
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 39585 W: 7183 L: 7094 D: 25308

Non functional change.
2017-01-21 10:13:49 +01:00
Stéphane Nicolet
9f8f093fd6 Update some comments (#973)
Use somewhat more precise comments in a couple of places.

No functional change.
2017-01-17 14:50:03 +01:00
Stefano Cardanobile
de02768af7 Introduce lazy evaluation
After we have taken into account all cheap evaluation
terms, we check whether the score exceeds a given threshold.
If this is the case, we return a scaled down evaluation.

STC:
LLR: 3.35 (-2.94,2.94) [0.00,5.00]
Total: 12575 W: 2316 L: 2122 D: 8137

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 67480 W: 9016 L: 8677 D: 49787

Current version is the one rewritten by ceebo
further edited by me.

Bench: 5367704
2017-01-13 09:17:48 +01:00
loco-loco
99cd513264 Removing CM parameter from the Stats struct. (#970)
After the history simplifications, we are only using Value Stats for CounterMoveHistory table. Therefore the parameter CM is not necessary.

No functional change.
2017-01-12 08:46:46 +01:00
Stéphane Nicolet
d2971f3fca Check for overflow in Score * int multiplication (#969)
Add asserts to check for overflow in Score * int multiplication.

There is no overflow in current master, but it would be easy to
create one as the scale of the current eval does not leave many
spare bits. For instance, adding the following unused variables
in master at the end of evaluate() (line 882 of evaluate.cpp)
overflows:

Score s1 = score * 4;  // no overflow
Score s2 = score * 5;  // overflow

Assertion failed: (eg_value(result) == (i * eg_value(s))),
function operator*, file ./types.h, line 336.

Same md5 checksum as current master for non debug compiles.

No functional change.
2017-01-11 18:11:17 +01:00
Rocky640
d40351243b StormDanger CleanUp (#964)
Order the enum and the array the same way they appear around line 250.
Makes it much easier to follow.

Add comments in the array definition and critical rows.
Use same terminology as elsewhere in pawns.cpp

No functional change.
2017-01-11 08:56:38 +01:00
Joost VandeVondele
d8f683760c Adjust copyright headers to 2017 (#965)
No functional change.
2017-01-11 08:46:29 +01:00
Marco Costalba
332b5013b5 Travis: fix bench fetch in case of PR (#968)
When Travis tests a PR, a commit merge is created
but master branch is not updated, although HEAD is.

No functional change.
2017-01-11 08:44:06 +01:00
lucasart
34e47ca87d Rename FromTo -> History (#963)
Previously, we had duplicated History:

- one with (piece,to) called History
- one with (from,to) called FromTo

Now that we have only one, rename it to History, which is the generally accepted
name in the chess programming litterature for this technique.

Also correct some comments that had not been updated since the introduction of CMH.

No functional change.
2017-01-10 08:47:56 +01:00
lucasart
e0504ab876 Remove HistoryStats
STC:
LLR: 3.44 (-2.94,2.94) [-3.00,1.00]
Total: 120831 W: 21572 L: 21594 D: 77665

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 26565 W: 3519 L: 3406 D: 19640

bench 5920493
2017-01-09 15:50:12 +01:00
Marco Costalba
d9dd520896 Fix previous patch for OS X (#961)
Use posix version of sed that is available on all
platforms.

No functional change.
2017-01-09 15:37:09 +01:00
Marco Costalba
394e9cd892 Trevis CI: use commit bench number as a reference
No functional change.
2017-01-09 12:51:28 +01:00
Joost VandeVondele
ba15781be8 New shell scripts for testing, used for travis CI (#957)
Perform more complex verification and validation.

- signature.sh : extract and optionally compare Bench/Signature/Node count.
- perft.sh : verify perft counts for a number of positions.
- instrumented.sh : run a few commands or uci sequences through valgrind/sanitizer instrumented binaries.
- reprosearch.sh : verify reproducibility of search.

These script can be used from directly from the command line in the src directory.

Update travis script to use these shell scripts.

No functional change.
2017-01-09 10:30:57 +01:00
ElbertoOne
d39ffbeea6 Simplified select best thread (#958)
Only select best thread if score is better and depth equal or larger.

STC (7 threads): http://tests.stockfishchess.org/tests/view/586a4d090ebc5903140c64b2
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 120297 W: 18652 L: 18682 D: 82963

LTC (7 threads): http://tests.stockfishchess.org/tests/view/586e31b30ebc5903140c663d
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 57187 W: 7035 L: 6959 D: 43193

bench: 4940355
2017-01-09 10:26:50 +01:00
Marco Costalba
3ab3e55bb5 Drop Stats c'tors
Now taht we correctly value-initialize Thread objects,
we don't need c'tors anymore because tables will be
zero-initialized by the compier when Thread object
is instanced.

Verified that we have no errors with Valgrind.

No functional change.
2017-01-07 10:14:39 +01:00
Joost VandeVondele
1c316c41bb Correctly zero-initialize MainThread
It can be used uninitialized in time management.
Fixes all valgrind errors on './stockfish go wtime 8000 btime 8000 winc 500 binc 500'

This is one (of the many) quirks of C++. There is a subtle difference between:

new Foo
new Foo()

The first statement calls the default constructor (that in case of a POD leaves data members
uninitialized), the second one performs a value-initialization (that in case of POD is
equivalent to a zero-initialization)

See:
http://stackoverflow.com/questions/620137/do-the-parentheses-after-the-type-name-make-a-difference-with-new
http://stackoverflow.com/questions/5116541/difference-between-creating-object-with-or-without

No functional change.
2017-01-07 10:02:43 +01:00
Joost VandeVondele
90b052462c Zero init fromToStats in constructor. (#953)
Extend commit fe99de to fromToStats, which fixes the last valgrind errors on 
a simple 'go depth 12' at startup.

No functional change.
2017-01-06 10:43:18 +01:00
pb00068
8b2c81d3ea Rejoin lines that belong to HalfDensity map (#952)
No functional change.
2017-01-05 09:00:41 +01:00
Marco Costalba
fe99de20ff Correct zero-init of Thread data members
If not explicitly initialized in a class constructor,
then all data members are default-initialized when
the corresponing struct/class is instanced.

For array and built-in types (int, char, etc..)
default-initialization is a no-op and we need to
explicitly zero them.

No functional change.
2017-01-05 08:50:17 +01:00
Joost VandeVondele
6b16ebc825 Use consistent variable names for counterMoveStats (#949)
Unify naming in movepick and search, by adopting the latter convention (cmh,fmh,fmh2).

No functional change.
2017-01-02 09:36:43 +01:00
Stéphane Nicolet
e3a8b8bcff Simplify unstoppable again (#950)
Assign a small bonus for our passed pawns when the opponent has no
pieces left.

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 51124 W: 9036 L: 8966 D: 33122

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 114560 W: 14604 L: 14604 D: 85352

Bench: 4940355
2017-01-02 09:33:40 +01:00
Jonathan Calovski
1052ce74f6 Tweak best thread selection logic
STC 7 threads:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 26881 W: 4161 L: 3941 D: 18779
http://tests.stockfishchess.org/tests/view/58667a830ebc5903140c632f

LTC 7 threads:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 22988 W: 2767 L: 2583 D: 17638
http://tests.stockfishchess.org/tests/view/586722690ebc5903140c636d

bench: 5468995
2017-01-01 11:28:50 +01:00
lucasart
e258c5a779 WDL: rename WDLCursedLoss into WDLBlessedLoss
Tested using syzygy bench method:

- 2016 random positions ranging between 3 and 10 pieces
- each searched using bench at depth=10

Same node count (and no speed regression).

No functional change.
2017-01-01 11:11:52 +01:00
Aram Tumanian
b7b9d7c9c7 Don't clear EasyMove in search()
EasyMove is cleared after every iteration of the
search if the 3rd move in the PV of the main thread
changes from the previous iteration. Therefore,
clearing EasyMove during a search iteration may be
excessive. The tests show that this is indeed unnecessary.
In the new version the EasyMove variable is used only in
the Thread::search function.

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 47719 W: 8438 L: 8362 D: 30919

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 122841 W: 15448 L: 15457 D: 91936

bench: 5468995
2017-01-01 11:04:24 +01:00
Sergei Antonov
881a9dfb0a Threefold repetition detection
Implement a threefold repetition detection. Below are the examples of
problems fixed by this change.

    Loosing move in a drawn position.
    position fen 8/k7/3p4/p2P1p2/P2P1P2/8/8/K7 w - - 0 1 moves a1a2 a7a8 a2a1
    The old code suggested a loosing move "bestmove a8a7", the new code suggests "bestmove a8b7" leading to a draw.

    Incorrect evaluation (happened in a real game in TCEC Season 9).
    position fen 4rbkr/1q3pp1/b3pn2/7p/1pN5/1P1BBP1P/P1R2QP1/3R2K1 w - - 5 31 moves e3d4 h8h6 d4e3
    The old code evaluated it as "cp 0", the new code evaluation is around "cp -50" which is adequate.

Brings 0.5-1 ELO gain. Passes [-3.00,1.00].

STC: http://tests.stockfishchess.org/tests/view/584ece040ebc5903140c5aea
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 47744 W: 8537 L: 8461 D: 30746

LTC: http://tests.stockfishchess.org/tests/view/584f134d0ebc5903140c5b37
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 36775 W: 4739 L: 4639 D: 27397

Patch has been rewritten into current form for simplification and
logic slightly changed so that return a draw score if the position
repeats once earlier but after or at the root, or repeats twice
strictly before the root. In its original form, repetition at root
was not returned as an immediate draw.

After retestimng testing both version with SPRT[-3, 1], both passed
succesfully, but this version was chosen becuase more natural. There is
an argument about MultiPV in which an extended draw at root may be sensible.
See discussion here:

   https://github.com/official-stockfish/Stockfish/pull/925

For documentation, current version passed both at STC and LTC:

STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 51562 W: 9314 L: 9245 D: 33003

LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 115663 W: 14904 L: 14906 D: 85853

bench: 5468995
2017-01-01 10:56:46 +01:00
Alain SAVARD
43f6b33e50 Small eval cleanup and renaming
Non-functional changes

a) splitting the threat array to avoid using an enum
b) reorder the scores according to functions where they are used.
c) declarations in evaluate_pieces after the const(s) like elsewhere
d) more compact definitions of KingFlank,
now that we need it also for the PanwLessFlank penalty.
e) reuse CenterFiles in evaluate_space
f) move one line inside next popcount

No functional change.
2016-12-31 14:15:57 +01:00
lucasart
ab4f498bbc Remove SafeCheck (#946)
It was a bit of a hack, without intrinsic value, but rather compensating for the
fact that checks were mistuned.

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 88308 W: 15553 L: 15545 D: 57210

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 53115 W: 6741 L: 6662 D: 39712

bench 5468995
2016-12-31 13:52:42 +01:00
Jörg Oster
8765f9ce16 Further simplify unstoppable (#938)
By finally moving it into passed pawns eval.

Tested for no regression:
STC
LLR: 3.25 (-2.94,2.94) [-3.00,1.00]
Total: 57109 W: 10023 L: 9947 D: 37139

LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 21511 W: 2800 L: 2680 D: 16031

Bench: 5255881
2016-12-25 10:44:56 +01:00
hxim
3728e833aa Fix psqt format and use smaller numbers in king psqt (#940)
Fix minus sign in pawn psqt and use smaller numbers in king psqt.

No functional change.
2016-12-25 10:40:17 +01:00
Joost VandeVondele
af7412e58a Explicitly use alpha+1 for beta in NonPV search (#939)
Fixes the only exception, in razoring.

The code already does assert(PvNode || (alpha == beta - 1)), and it can be verified by studying the program flow that this is indeed the case, also for the modified line.

No functional change.
2016-12-25 10:34:48 +01:00
Joost VandeVondele
1ceaea701b Simplify threshold handling for probcut. (#936)
Just use greater equal as this is what see_ge does now.

passed STC
LLR: 2.94 (-2.94,2.94) [-3.00,1.00]
Total: 226506 W: 39755 L: 39978 D: 146773

passed LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 138483 W: 17450 L: 17479 D: 103554

Bench: 5212921
2016-12-22 16:02:32 +01:00
Stefano Cardanobile
f72b7dc99a piecesCount (#932)
All counts in search.cpp are of the form xxxCount. Conform piecesCnt to this unwritten rule.

No functional change.
2016-12-20 11:18:19 +01:00
Joost VandeVondele
ee22b61f5e Use DEPTH_ZERO initializer for depth in qsearch (#931)
Simplifies the main search function.

No functional change.
2016-12-20 11:17:38 +01:00
VoyagerOne
8c61bbda54 Another simplification for SEE pruning
STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 29310 W: 5225 L: 5118 D: 18967

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 128454 W: 16424 L: 16442 D: 95588

Bench: 4556848
2016-12-17 08:37:58 +01:00
Stefan Geschwentner
847bc0e80f Simplify pruning
STC: http://tests.stockfishchess.org/tests/view/5842be140ebc5903140c5619
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 16014 W: 2839 L: 2710 D: 10465

LTC: http://tests.stockfishchess.org/tests/view/584316a50ebc5903140c5638
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 182360 W: 22830 L: 22914 D: 136616

Retested at LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 45502 W: 5821 L: 5732 D: 33949

Bench: 4684146
2016-12-12 12:01:16 +01:00
Joost VandeVondele
1b62d413c1 Clean-up skipEarlyPruning (#921)
make skipEarlyPruning a search argument instead of managing this by hand.

Verified for no regression at STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 96754 W: 17089 L: 17095 D: 62570

No functional change.
2016-12-11 20:05:25 +01:00
Jonathan Calovski
589049a0e5 Simplify unstoppable condition
STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 86389 W: 15165 L: 15153 D: 56071

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 98143 W: 12311 L: 12288 D: 73544

Bench: 5437987
2016-12-11 19:57:02 +01:00
Joost VandeVondele
a47bbca0ea Refactor bonus and penalty calculation (#917)
* Refactor bonus and penalty calculation

Compute common terms in a helper function.

No functional change.

* Further refactoring

Remove some parenthesis that are now useless.
Define prevSq once, use repeatedly.

No functional change.

bench: 5884767 (bench of previous patch is wrong)
2016-12-05 18:58:12 +01:00
Stéphane Nicolet
0d33466bcd Pawn flank attacks
This patch tweaks some pawn values to favor flank attacks.

The first part of the patch increases the midgame psqt values of external pawns to launch more attacks (credits to user GuardianRM for this idea), while the second part increases the endgame connection values for pawns on upper ranks.

Passed STC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 34997 W: 6328 L: 6055 D: 22614

and LTC:
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 13844 W: 1832 L: 1650 D: 10362

Bench: 5884767
2016-12-05 18:49:07 +01:00
ElbertoOne
46d066b041 Remove piece condition in decrease lmr reduction check
STC: http://tests.stockfishchess.org/tests/view/584154780ebc5903140c55cf
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 40866 W: 7251 L: 7164 D: 26451

LTC: http://tests.stockfishchess.org/tests/view/5841e6e50ebc5903140c5605
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 62413 W: 7948 L: 7881 D: 46584

Bench: 5807913
2016-12-04 09:28:55 +01:00
Andrey Neporada
bf8b45fe63 Help GCC to optimize msb() to single instruction
GCC compiles builtin_clzll to “63 ^ BSR”. BSR is processor instruction "Bit Scan Reverse".
So old msb() function is basically 63 - 63 ^ BSR.
Unfortunately, GCC fails to simplify this expression.

Old function compiles to

    bsrq    %rdi, %rdi
    movl    $63, %eax
    xorq    $63, %rdi
    subl    %edi, %eax
    ret

New function compiles to

    bsrq    %rdi, %rax
    ret

BTW, Clang compiles both function to the same (optimal) code.

No functional change.
2016-12-03 09:37:07 +01:00
goodkov
e70da0d2eb Simplify pruning rule
STC: http://tests.stockfishchess.org/tests/view/583df86d0ebc5903140c5481
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 43283 W: 7761 L: 7678 D: 27844

LTC: http://tests.stockfishchess.org/tests/view/583f42670ebc5903140c5525
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 56587 W: 7232 L: 7157 D: 42198

bench: 5084980
2016-12-02 09:04:45 +01:00
Joost VandeVondele
1e76ba7cec WeakQueen Parameter tweak
New tuned values.

passed STC
http://tests.stockfishchess.org/tests/view/5834573c0ebc5903140c507b
LLR: 3.16 (-2.94,2.94) [0.00,4.00]
Total: 157415 W: 27917 L: 27227 D: 102271

passed LTC
http://tests.stockfishchess.org/tests/view/58388d2b0ebc5903140c523b
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 95405 W: 12350 L: 11959 D: 71096

Bench: 4912054
2016-12-01 14:55:00 +01:00
ElbertoOne
535435b7fc TrappedRook simplification
Just remove rank checks for rook and king for TrappedRook evaluation.

STC: http://tests.stockfishchess.org/tests/view/5833fdfc0ebc5903140c5050
LLR: 3.03 (-2.94,2.94) [-3.00,1.00]
Total: 34474 W: 6088 L: 5986 D: 22400

LTC: http://tests.stockfishchess.org/tests/view/58392f3f0ebc5903140c5276
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 48358 W: 6221 L: 6136 D: 36001

bench: 5536128
2016-11-27 17:42:20 +01:00
theo77186
7a3844e6ef Fix PGO build with GCC (#904) 2016-11-27 14:43:52 +01:00
Michael Byrne
fbb2ffacfd Fix PGO Build for clang
This fixes https://github.com/official-stockfish/Stockfish/issues/167.

Additional improvments by Joost VandeVondele.
2016-11-27 10:03:52 +01:00
joergoster
8f30d233f8 Fix trace in case of space evaluation
We only compute space eval during the opening/early midgame.
Apply the same logic for DoTrace.

No functional change.
2016-11-27 09:28:32 +01:00
Marco Costalba
ec83e8a72c Fix regression: print const position
Fix a regression introduced with new TB code.

No functional change.
2016-11-27 09:11:56 +01:00
mbootsector
e7289465b9 Rank based threats
STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 19404 W: 3581 L: 3374 D: 12449

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 16204 W: 2194 L: 2023 D: 11987

Bench: 5757843
2016-11-27 09:05:57 +01:00
Joost VandeVondele
8ceb1ff53b Fix undefined behavior
This fixes #892. Undefined behavior as seen with
clang -fsanitize=undefined.

No functional change.
2016-11-26 16:49:59 +01:00