1
0
Fork 0
Commit Graph

4193 Commits (378c8bdbb8f930472fc4316aa6c417802294bbad)

Author SHA1 Message Date
Marco Costalba 25296547d0 Move Pieces[] out of global visibility
It is an helper array used only in position.cpp

Also small code tidy up while there.

No functional change.

Closes #1106
2017-05-07 20:20:02 -07:00
mstembera 321a27fbe3 Avoid *begin always being included in the sorted list regardless of its value.
This was a minor criticism by @zamar in the original pull request
https://github.com/official-stockfish/Stockfish/pull/1065
necessitating a comment explanation.

No functional change.

Closes #1091
2017-05-07 20:15:56 -07:00
joergoster 8b15961349 Fix multiPV issue #502
In general, this patch handles the cases where we don't have a valid score for each PV line in a multiPV search. This can happen if the search has been stopped in an unfortunate moment while still in the aspiration loop. The patch consists of two parts.

Part 1: The new PVIdx was already part of the k-best pv's in the last iteration, and we therefore have a valid pv and score to output from the last iteration. This is taken care of with:

      bool updated = (i <= PVIdx && rootMoves[i].score != -VALUE_INFINITE);

Case 2: The new PVIdx was NOT part of the k-best pv's in the last iteration, and we have no valid pv and score to output. Not from the current nor from the previous iteration. To avoid this, we are now also considering the previous score when sorting, so that the PV lines with no actual but with a valid previous score are pushed up again, and the previous score can be displayed.

  bool operator<(const RootMove& m) const {
    return m.score != score ? m.score < score : m.previousScore < previousScore; } // Descending sort

I also added an assertion in UCI::value() to possibly catch similar issues earlier.

No functional change.

Closes #502
Closes #1074
2017-05-03 19:46:40 -07:00
Joost VandeVondele e9f26cccdd gcc 7 port
Testing the release candidate revealed only one minor issue, namely a new warning -Wimplicit-fallthrough (part of -Wextra) triggers in the movepicker. This can be silenced by adding a comment, and once we move to c++17 by adding a standard annotation [[fallthrough]];.

No functional change.

Closes #1090
2017-04-30 08:43:43 -07:00
VoyagerOne a18c2c2c3f Don't do InCheck Pruning at the root of QS
STC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 34603 W: 6441 L: 6167 D: 21995

LTC:
LLR: 2.97 (-2.94,2.94) [0.00,5.00]
Total: 24474 W: 3274 L: 3076 D: 18124

Bench: 5934421

Closes #1089
2017-04-28 20:40:45 -07:00
Rocky640 b948b037a5 Remove cap in kingDanger initialization
Passed STC
http://tests.stockfishchess.org/tests/view/58fd53be0ebc59035df33eb5
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 52048 W: 9397 L: 9329 D: 33322

Passed LTC
http://tests.stockfishchess.org/tests/view/58ff9e0a0ebc59035df33f5c
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 35382 W: 4650 L: 4549 D: 26183

Bench: 5872717

Closes #1087
2017-04-28 20:38:03 -07:00
Marco Costalba e06a117d5e Retire the misdesigned StepAttacks[] array.
StepAttacks[] is misdesigned, the color dependance is specific
to pawns, and trying to generalise to king and knights, proves
neither useful nor convinient in practice.

So this patch reformats the code with the following changes:

- Use PieceType instead of Piece in attacks_() functions

- Use PseudoAttacks for KING and KNIGHT

- Rename StepAttacks[] into PawnAttacks[]

Original patch and idea from Alain Savard.

No functional change.

Closes #1086
2017-04-28 20:33:30 -07:00
Joost VandeVondele b1b19343cd Copy killers in the movepicker
ss->killers can change while the movepicker is active.
The reason ss->killers changes is related to the singular
extension search in the moves loop that calls search<>
recursively with ss instead of ss+1,
effectively using the same stack entry for caller and callee.
By making a copy of the killers,
the movepicker does the right thing nevertheless.

Tested as a bug fix

STC:
http://tests.stockfishchess.org/tests/view/58ff130f0ebc59035df33f37
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 70845 W: 12752 L: 12716 D: 45377

LTC:
http://tests.stockfishchess.org/tests/view/58ff48000ebc59035df33f3d
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 28368 W: 3730 L: 3619 D: 21019

Bench: 6465887

Closes #1085
2017-04-28 20:29:04 -07:00
snicolet 49a9d4cf99 Avoid misuse of StepAttacksBB for pawns
Make it explicit that first index of StepAttacksBB is a piece, not a piece type.

No functional change

Closes #1083
2017-04-25 17:57:49 -07:00
Joost VandeVondele d06a8d0c18 Zero unused constant
No functional change

Closes #1081
2017-04-25 17:21:36 -07:00
Marco Costalba b48439e906 Assorted code style issues
I have removed the check for

 pieceCount[PAWN] > FILE_NB

because totally useless.

No functional change.
2017-04-24 09:49:44 +02:00
Joost VandeVondele 6b9a22b40d Sort moves partially: linear depth dependence
STC: http://tests.stockfishchess.org/tests/view/58f98d260ebc59035df33d5e
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 58958 W: 10862 L: 10485 D: 37611

LTC: http://tests.stockfishchess.org/tests/view/58fa45d40ebc59035df33d86
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 18607 W: 2427 L: 2251 D: 13929

Bench: 6065528

Closes #1079
2017-04-23 08:37:55 -07:00
IIvec 0868de705d King safety parameters improved
STC:
LLR: 2.97 (-2.94,2.94) [0.00,4.00]
Total: 58648 W: 10883 L: 10524 D: 37241

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 52546 W: 7131 L: 6844 D: 38571

Bench 6121479

Closes #1078
2017-04-23 08:04:03 -07:00
Joost VandeVondele 9da3b44ddc Use int instead of Value for history related stats.
history related scores are not related to evaluation based scores.
For example, can easily exceed the range -VALUE_INFINITE,VALUE_INFINITE.
As such the current type is confusing, and a plain int is a better match.

tested for no regression:

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 43693 W: 7909 L: 7827 D: 27957

No functional change.

Closes #1070
2017-04-23 07:59:28 -07:00
Joost VandeVondele ced29248c9 simplify logic for history based pruning
STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 34255 W: 6292 L: 6194 D: 21769

LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 89914 W: 11769 L: 11739 D: 66406

Bench: 6581936

Closes #1066
2017-04-20 11:28:11 -07:00
Joost VandeVondele 2d96e8fbe9 Partial insertion sort
the order of elements returned by std::partition is implementation defined (since not stable) and could depend on the version of libstdc++ linked.
As std::stable_partition was tested to be too slow (http://tests.stockfishchess.org/tests/view/585cdfd00ebc5903140c6082).
Instead combine partition with our custom implementation of insert_sort, which fixes this issue.
Implementation based on a patch by mstembera (http://tests.stockfishchess.org/tests/view/58d4d3460ebc59035df3315c), which suggests some benefit by itself.
Higher depth moves are all sorted (INT_MIN version), as in current master.

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 33116 W: 6161 L: 6061 D: 20894

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 88703 W: 11572 L: 11540 D: 65591

Bench: 6256522

Closes #1058
Closes #1065
2017-04-20 11:19:01 -07:00
Stefano Cardanobile d4b9ee0f1d Update Readme.md
Update number of threads.

Closes #1072
2017-04-17 10:38:37 -07:00
Joost VandeVondele 57a3334322 Prefer std::find over a hand-coded loop
tested for no regression.

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 37378 W: 6649 L: 6556 D: 24173

No functional change.

Closes #1071
2017-04-17 09:25:27 -07:00
VoyagerOne 9d3ed9ed2e Move-Count Formula Tweak
STC:
LLR: 3.18 (-2.94,2.94) [0.00,4.00]
Total: 55004 W: 10289 L: 9930 D: 34785

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 48184 W: 6401 L: 6128 D: 35655

Bench: 5960754
2017-04-17 09:22:10 -07:00
Stefano80 06175c6055 Remove cap from space score contribution and increase bonus
STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 58462 W: 10615 L: 10558 D: 37289

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 65061 W: 8539 L: 8477 D: 48045

It is worth noting that an attempt to only increase the bonus passed STC but failed LTC, and
an attempt to remove the cap without increasing the bonus is still running at STC, but will probably fail after more than 100k.

Bench: 6188591

Closes #1063
2017-04-17 09:19:36 -07:00
Stéphane Nicolet 1454831220 Doubled and supported pawns
Do not give the doubled pawn penalty when the frontmost pawn is
supported, for instance f2-g2-g3

STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 55927 W: 10418 L: 10052 D: 35457
http://tests.stockfishchess.org/tests/view/58eb9fc20ebc59035df33858

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 32078 W: 4257 L: 4035 D: 23786
http://tests.stockfishchess.org/tests/view/58ec48420ebc59035df3388b

Bench: 5995472

Closes #1062
2017-04-16 06:22:48 -07:00
Stefano80 b258b4fee7 Remove minimum to contribution from king danger to score.
STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 24858 W: 4559 L: 4445 D: 15854

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 40789 W: 5338 L: 5244 D: 30207

Bench: 7027489

Closes #1059
2017-04-09 07:48:58 -07:00
joergoster 72a501c6fe Fix zugzwang pruning issues
By adding pos.non_pawn_material(pos.side_to_move()) as a precondition in step 13,
which is already in use in Futility Pruning (child node) and Null Move Pruning for similar reasons.

Pawn endgames, especially those with only 1 or 2 pawns, are simply heavily influenced by zugzwang situations.

Since we are using a bitbase for KPK endgames, I see no reason to accept buggy evals as shown in #760

Patch looks neutral at STC
LLR: 2.32 (-2.94,2.94) [-3.00,1.00]
Total: 79580 W: 10789 L: 10780 D: 58011

and LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 27071 W: 3502 L: 3390 D: 20179

Bench: 6259071

Closes #1051
Closes #760
2017-04-07 17:15:00 -07:00
VoyagerOne 35b77b120e Standardize stat penalty
STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 90631 W: 16325 L: 16323 D: 57983

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 97679 W: 12779 L: 12759 D: 72141

Bench: 6340591

Closes #1053
2017-04-07 17:02:31 -07:00
VoyagerOne ebe021f6a5 Don't update TT at excluded move ply
STC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 38906 W: 7125 L: 6835 D: 24946

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 28600 W: 3752 L: 3543 D: 21305

Bench:  6861050

Closes #1048
2017-04-02 20:32:54 -07:00
Daniel Dugovic 06eba14dc9 Add assertion for the maximum number of pawns
No functionl change

Closes #1039
2017-03-27 15:55:48 -07:00
Joost VandeVondele c5de4080db Introduce assert for stats update
Make sure updates to the stats are done in a stable way.

No functional change

Closes #1038
Closes #1037
2017-03-25 17:57:07 -07:00
Joost VandeVondele 3b7c1a17e4 Increase maximum number of threads
a single Xeon Phi can present itself as a single numa node with up to 288 threads (4 threads per hardware core).
Tested to work as expected with a Xeon Phi CPU 7230 up to 256 threads.

No functional change

Closes #1045
2017-03-25 10:35:17 -07:00
joergoster afe75571d8 Simplify ThreatBySafePawn scoring
Bench: 6197938

Closes #1047
2017-03-25 10:22:20 -07:00
VoyagerOne 30c583204f Singular extension and check extension tweak
If singular extension fails to trigger extension then don't consider check extension.

STC:
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 69428 W: 12663 L: 12271 D: 44494

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 44023 W: 5875 L: 5612 D: 32536

Bench: 6170444

Closes #1043
2017-03-25 10:13:25 -07:00
VoyagerOne 352bd6f5aa Skip quiet moves based on moveCount pruning threshold and history stats
If we can moveCountPrune and next quiet move has negative stats,
then go directly to the next move stage (Bad_Captures).

Reduction formula is tweaked to compensate for the decrease in move count that is used in LMR.

STC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 6847 W: 1276 L: 1123 D: 4448

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 48687 W: 6503 L: 6226 D: 35958

Bench: 5919519

Closes #1036
2017-03-18 15:44:49 -07:00
Joost VandeVondele c80d52c845 History stat bonus: Move condition to bonus calculation
about 0.5% speedup.

No functional change

Closes #1034
2017-03-17 14:46:47 -07:00
joergoster c076216a32 Pawns count imbalance table
Instead of having a continuous increasing bonus for our number of pawns when calculating imbalance, use a separate lookup array with tuned values.
Idea by GuardianRM.

STC
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 16155 W: 2980 L: 2787 D: 10388

LTC
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 100478 W: 13055 L: 12615 D: 74808

Bench: 6128779

Closes #1030
2017-03-17 14:41:08 -07:00
Marco Costalba a6d6a2c2fa Assorted code style fixes
No functional change

Closes #1029
2017-03-14 21:02:21 -07:00
mstembera d01b66ae8f Fix pawn entry prefetch
No functional change

Closes #1026
2017-03-14 20:56:26 -07:00
snicolet c3d2e6aba9 Helper functions to count material for both sides
Syntactic sugar: helper functions to count material or pieces for both sides.

No functional change

Closes #1025
2017-03-08 18:45:38 -08:00
Joost VandeVondele d490bb9973 Always have counterMoves associated
Simplifies away all associated checks, leading to a ~0.5% speedup.
The code now explicitly checks if moves are OK, rather than using nullptr checks.

Verified for no regression:

LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 32218 W: 5762 L: 5660 D: 20796

No functional change

Closes #1021
2017-03-08 18:35:23 -08:00
pb00068 cc76524c2e Further simplify skipping of plies with threads
No functional change

Closes #1020
2017-03-08 18:03:01 -08:00
VoyagerOne 3627348e2b Allow pruning advance pawn pushes if not near endgame
STC:
LLR: -2.95 (-2.94,2.94) [0.00,5.00]
Total: 101088 W: 18016 L: 17717 D: 65355

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 61194 W: 8108 L: 7791 D: 45295

Bench: 5803228

Closes #1023
2017-03-05 18:58:06 -08:00
snicolet 728ce2195c Speed-up some arrays reading
This patch removes the empty rows at the beginning and at the end of
MobilityBonus[] and Protector[] arrays:

• reducing the size of MobilityBonus from 768 bytes to 512 bytes
• reducing the size of Protector from 1024 to 512 bytes

Also adds some comments and cleaner code for the arrays in pawns.cpp

No speed penalty (measured speed-up of 0.4%).

No functional change.

Closes #1018
2017-03-05 18:20:27 -08:00
Joost VandeVondele 1810c4d758 Simplify skipping of plies with helper threads
Replaces the HalfDensity array with an equivalent, compact implementation.
Includes suggestions by mcostalba & snicolet.

No functional change

Closes #1004
2017-02-26 16:41:58 -08:00
snicolet 8f7e032b8c Change definition of "weak" in threats calculation
By defining "strongly protected" as "protected by a pawn, or protected
by two pieces and not attacked by two enemy pieces".

Passed STC:
LLR: 2.97 (-2.94,2.94) [0.00,5.00]
Total: 17050 W: 3128 L: 2931 D: 10991

Passed LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 120995 W: 15852 L: 15343 D: 89800

Bench : 6269229

Closes #1016
2017-02-25 17:43:54 -08:00
mstembera f1e3dfea74 Reorder members of Material::Entry
This eliminates alignment padding and reduces size from 48 to 40 bytes.
This makes the material HashTable smaller and more cache friendly.

No functional change

Closes #1013
2017-02-23 21:33:03 -08:00
GuardianRM 9f48e1ec15 Pieces protecting king
Initial protective idea by Snicolet for knight, for other pieces too
Patch add penalties and bonuses for pieces, depending on the distance from the own king

STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 21192 W: 3919 L: 3704 D: 13569

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 26177 W: 3642 L: 3435 D: 19100

Bench : 6687377

Closes #1012
2017-02-23 21:26:59 -08:00
snicolet eefbe967c2 Keep pawns on both flanks
Positions with pawns on only one flank tend to be more drawish. We add
a term to the initiative bonus to help the attacking player keep pawns
on both flanks.

STC: yellowish run stopped after 257137 games
LLR: -0.92 (-2.94,2.94) [0.00,5.00]
Total: 257137 W: 46560 L: 45511 D: 165066

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 15602 W: 2125 L: 1956 D: 11521

Bench : 6976310

Closes #1009
2017-02-19 14:27:03 -08:00
FauziAkram c243cd5f4a Variable tuning
A tuning patch which cover the following changes:

increase the importance of queen and rook mobility in endgame and
decrease it in mg, since if we use the heavy pieces too early in the game
we will just make opponent develop their pieces by threatening ours.

King Psqt:
1)King will be encouraged more to stay in the first ranks in the MG
2)and will be encouraged more to go to the middle of the board/last ranks in the EG

Bishop scale better in EG
Logical changes on various psqt tables
1/6 of the changes of the last tuning session on mobility tables

STC: LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 227879 W: 41240 L: 40313 D: 146326
LTC : LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 167047 W: 21871 L: 21291 D: 123885

Bench: 5695960

Closes #1008
2017-02-19 14:00:44 -08:00
VoyagerOne 05cf45f2d1 Razor Simplification
Remove code that restrict using tt-moves for razoring.

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 67442 W: 12039 L: 11997 D: 43406

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 38541 W: 5044 L: 4947 D: 28550

Bench: 5667216

Closes #1002
2017-02-18 22:50:37 -08:00
torfranz faedcf08a8 Retire loose enemies bonus
STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 44727 W: 7943 L: 7862 D: 28922

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 148343 W: 19044 L: 19088 D: 110211

Bench: 5669076

Closes #1005
2017-02-14 21:26:08 -08:00
VoyagerOne 83fb4547f6 search(): Move nullValue variable into local scope
No functional change

Closes #1003
2017-02-14 21:22:58 -08:00
Joost VandeVondele 1e814e0ca0 Fix makefile: 32 bit builds without optimization.
Fixes failing build for

make ARCH=x86-32 clean && make ARCH=x86-32 optimize=no build

by passing -m32 also to the link step.

Extend travis testing accordingly.

No functional change.

Closes #999
2017-02-14 21:11:44 -08:00