1
0
Fork 0
Commit Graph

231 Commits (820c5c25b649d6bdd51bed14a16efdc11719b588)

Author SHA1 Message Date
Mike Whiteley 820c5c25b6 rename shift variables.
Where variable names are explicitly incorrect, I feel morally obligated to at least
suggest an alternative. There are many, but these two are especially egregious.

No functional change.
2018-02-21 21:47:04 +01:00
Marco Costalba 67f5f54a29 Code style in evaluate.cpp
Passed STC
LLR: 2.95 (-2.94,2.94) [-4.00,0.00]
Total: 75666 W: 16482 L: 16616 D: 42568
http://tests.stockfishchess.org/tests/view/5a8953af0ebc590297cc83ab

No functional change.
2018-02-20 17:11:18 +01:00
FauziAkram 917fe69f84 A combo of 3 successful tuning patches
Shelter Weakness by Fauzi Akram Dabat
Threats by Alain Savard
Passed Pawns by Alain Savard

STC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 51378 W: 11592 L: 11223 D: 28563
http://tests.stockfishchess.org/tests/view/5a79e2fe0ebc5902971a99d1

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 21631 W: 3888 L: 3661 D: 14082
http://tests.stockfishchess.org/tests/view/5a7aefe80ebc5902971a9a39

Bench: 4983414
2018-02-08 15:14:02 +01:00
Torsten Franz 2e11388581 Retire lever (#1378)
Retire the lever bonus from pawns evaluation

STC: http://tests.stockfishchess.org/tests/view/5a6aef5c0ebc590d945d59c8
LLR: 2.94 (-2.94,2.94) [-3.00,1.00]
Total: 88290 W: 19549 L: 19560 D: 49181

LTC: http://tests.stockfishchess.org/tests/view/5a6b70140ebc590d945d59f7
LLR: 3.22 (-2.94,2.94) [-3.00,1.00]
Total: 104603 W: 18105 L: 18108 D: 68390

Bench 5023629
2018-01-30 09:40:56 +01:00
Joost VandeVondele 9afa1d7330 New Year 2018
Adjust copyright headers.

No functional change.
2018-01-01 13:18:10 +01:00
syzygy1 822695d4d3 Use a Direction enum for Square deltas
Currently the NORTH/WEST/SOUTH/EAST values are of type Square, but conceptually they are not squares but directions. This patch separates these values into a Direction enum and overloads addition and subtraction to allow adding a Square to a Direction (to get a new Square).

I have also slightly trimmed the possible overloadings to improve type safety. For example, it would normally not make sense to add a Color to a Color or a Piece to a Piece, or to multiply or divide them by an integer. It would also normally not make sense to add a Square to a Square.

This is a non-functional change.
2017-12-04 17:52:31 +01:00
Joost VandeVondele 2acda1fde3 Use bool(Bitboard b) instead of !!b (#1321)
The idiom !!b is confusing newcomers (e.g. Stefan needs explaining here https://groups.google.com/d/msg/fishcooking/vYqnsRI4brY/Gaf60QuACwAJ).

No functional change.
2017-12-03 18:29:55 +01:00
Stéphane Nicolet 043a469f83 Score unopposed weak pawns only if majors
Do not use the opposed flag for scoring backward and isolated pawns
in pawns.cpp, instead give a S(5,25) bonus for each opponent unopposed
weak pawns when we have a rook or a queen on the board.

STC run stopped after 113188 games:
LLR: 1.63 (-2.94,2.94) [0.00,5.00]
Total: 113188 W: 20804 L: 20251 D: 72133
http://tests.stockfishchess.org/tests/view/59b58e4d0ebc5916ff64b12e

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 66673 W: 8672 L: 8341 D: 49660
http://tests.stockfishchess.org/tests/view/59b902580ebc5916ff64b231

This is Alain Savard's idea, just with a different bonus.
Original patch there:

green STC, http://tests.stockfishchess.org/tests/view/597dcd2b0ebc5916ff64a09b
yellow LTC, http://tests.stockfishchess.org/tests/view/597ea69e0ebc5916ff64a0e6

Bench: 6259498
2017-09-17 09:52:27 +02:00
ianfab ed8286eb1b Extend ShelterWeakness array by dimension isKingFile
Use different penalties for weaknesses in the pawn shelter
depending on whether it is on the king's file or not.

STC
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 71617 W: 13471 L: 13034 D: 45112

LTC
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 48708 W: 6463 L: 6187 D: 36058

Bench: 5322108
2017-09-09 12:23:34 +02:00
snicolet 53c2d9df5e Tweak connected pawns seed[] array values
Raise a little bit the values in the connected pawns seed[] array.

STC:
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 99033 W: 17939 L: 17448 D: 63646
http://tests.stockfishchess.org/tests/view/597355630ebc5916ff649e3e

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 48044 W: 6371 L: 6099 D: 35574
http://tests.stockfishchess.org/tests/view/597596610ebc5916ff649eba

Bench: 5608839

Closes #1182
2017-08-01 18:41:29 -07:00
Rocky640 b24bd762b2 Rework the "unsupported" penalty into a "supported" bonus
A pawn (according to all the searched positions of a bench run) is not supported 85% of the time,
(in current master it is either isolated, backward or "unsupported").

So it made sense to try moving the S(17, 8) "unsupported" penalty value into the base pawn value hoping for a more representative pawn value, and accordingly
a) adjust backward and isolated so that they stay more or less the same as master
b) increase the mg connected bonus in the supported case by S(17, 0) and let the Connected formula find a suitable eg value according to rank.

Tested as a simplification SPRT(-3, 1)

Passed STC
http://tests.stockfishchess.org/tests/view/5970dbd30ebc5916ff649dd6
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 19613 W: 3663 L: 3540 D: 12410

Passed LTC
http://tests.stockfishchess.org/tests/view/597137780ebc5916ff649de3
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 24721 W: 3306 L: 3191 D: 18224

Bench: 5581946

Closes #1179
2017-08-01 18:37:54 -07:00
Alain SAVARD 6d24ef8585 Tidy up
No functional change

Closes #1148
2017-07-02 21:53:45 -07:00
Alain SAVARD 2c237da546 Misc coding style fixes
a few comment and blank fixes.

No functional change

Closes #1141
2017-06-16 19:55:30 -07:00
Marco Costalba 0c1f119069 Default argument for see_ge()
No functional change.

Closes #1111
2017-05-10 18:20:45 +02:00
Stefan Geschwentner 69ec09bd4b Bonus for pawn scrifice which create passed pawn
STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 16752 W: 3141 L: 2944 D: 10667

LTC:
LLR: 3.34 (-2.94,2.94) [0.00,5.00]
Total: 33928 W: 4544 L: 4300 D: 25084

Bench: 5639223

Closes #1092
2017-05-07 20:51:52 -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
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
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
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
Stefan Geschwentner 471f7a1b5c Candidate passed pawns
Detect safe candidate passers.

STC: http://tests.stockfishchess.org/tests/view/5882395c0ebc5915193f78b3
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 53569 W: 9925 L: 9570 D: 34074

LTC: http://tests.stockfishchess.org/tests/view/5882b4fb0ebc5915193f78e2
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 77576 W: 10387 L: 10014 D: 57175

Bench: 5325829
2017-01-28 09:04:24 +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
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
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
Alain SAVARD 76d113f5f0 Pawn shelter and pawn storm tuned
Based on SPSA tuned values

Passed STC
http://tests.stockfishchess.org/tests/view/582363b30ebc5910626b9ca8
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 40628 W: 7380 L: 7087 D: 26161

and passed LTC
http://tests.stockfishchess.org/tests/view/5823b73b0ebc5910626b9cb5
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 273312 W: 35991 L: 35131 D: 202190

bench: 5773672
2016-11-19 09:42:11 +01:00
Stefano Cardanobile 0162fb83c2 Retire implicit malus for stonewalls
STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 75864 W: 13466 L: 13437 D: 48961

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 99050 W: 12472 L: 12451 D: 74127

bench: 6098474
2016-10-05 09:32:08 +02:00
Stéphane Nicolet 7ae3c05795 Rename shift_bb() to shift()
Rename shift_bb() to shift(), and DELTA_S to SOUTH, etc.
to improve code readability, especially in evaluate.cpp
when they are used together:

    old b = shift_bb<DELTA_S>(pos.pieces(PAWN))
    new b = shift<SOUTH>(pos.pieces(PAWN))

While there fix some small code style issues.

No functional change.
2016-09-25 10:45:10 +02:00
Stéphane Nicolet d37dfe9ae4 Space bonus in presence of open files
If the opponent has a cramped position, opening a file often
helps him/her to exchange pieces, so it makes sense to reduce
the space bonus if there are open files.

Credits: Leonardo Ljubičić for the strategic idea, Alain Savard for the
implementation of the open files calculation, "CrunchyNYC" for the
compensation of the numerator.

STC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 49112 W: 9239 L: 8900 D: 30973

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 89415 W: 12014 L: 11601 D: 65800

Bench: 7591630
2016-09-03 00:04:20 +02:00
Marco Costalba e3af492142 Remove a stale assignment
No more used after previous patch.

Spotted by Jekaa .

No functional change.
2016-08-18 10:40:56 +02:00
Stefano80 9585f8ef58 Retire pawn span
Retire pawn span and replace with pawn count in evaluate_scale_factor.

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 26482 W: 4929 L: 4818 D: 16735

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 61938 W: 8400 L: 8335 D: 45203

Bench: 7662861
2016-08-18 10:16:56 +02:00
Marco Costalba 190d2ea4bc Restore standard passed pawn definition
Use the usual and accepted passed pawn semantic
instead of a non-standard one and remove a FIXME.

STC (http://tests.stockfishchess.org/tests/view/576401350ebc5972faa1608d):
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 29646 W: 5663 L: 5557 D: 18426

LTC (http://tests.stockfishchess.org/tests/view/5764e4e90ebc5972faa160c3):
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 40224 W: 5578 L: 5484 D: 29162

bench: 7543902
2016-06-25 11:46:17 +02:00
Stéphane Nicolet ab0f4c0353 Simplify doubled pawn
Only use doubled pawn malus when the doubled pawns are on consecutive squares.

Passed STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 7678 W: 1469 L: 1325 D: 4884

And LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 26739 W: 3562 L: 3449 D: 19728

Bench: 8211685
2016-05-26 12:33:44 +02:00
Stéphane Nicolet 16c603ce9b Double pawn simplification
Try doubled pawn simplification, with psq
table compensation.

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 36094 W: 6558 L: 6463 D: 23073

LTC:
LLR: 2.94 (-2.94,2.94) [-3.00,1.00]
Total: 102352 W: 13417 L: 13404 D: 75531

Bench: 8716243
2016-05-13 13:01:59 +02:00
Stéphane Nicolet 2694ef23c3 Isolated pawn simplification
STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 117822 W: 21697 L: 21744 D: 74381

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 92307 W: 12330 L: 12305 D: 67672

Bench: 8813983

Resolves #659
2016-04-30 22:23:22 +01:00
Alain SAVARD 29b5842da8 Backward simplication
On top of the usual conditions
a) some opponent in front (but no lever)
b) some neighbours (in front) (but no neighbour behind or same rank)
c) < rank_5

to find out if a pawn is backward we look at the squares in front of this pawn to reach the same rank as the next neighbour.

In current master, a pawn is backward if any of those squares is controlled by an enemy pawn on an adjacent file

In this version, a pawn is ALSO backward if any of those squares is occupied by an enemy pawn.

STC:
http://tests.stockfishchess.org/tests/view/56fe7efd0ebc59301a3541f1
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 19051 W: 3557 L: 3433 D: 12061

LTC:
http://tests.stockfishchess.org/tests/view/56febc2d0ebc59301a354209
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 40810 W: 5619 L: 5526 D: 29665

Bench: 7525245

Resolves #614
2016-04-08 19:12:55 +01:00
mstembera 8fb45caade Simplify popcnt
Also a speedup(about 1%) on 64-bit w/o hardware popcnt

Retire Max15 and Full template parameters
(Contributed by Marco Costalba)

Now that we have just SW and HW versions, use
template default parameter to get rid of explicit
template parameters.

Retire bitcount.h and move the only defined
function to bitboard.h

No functional change

Resolves #620
2016-04-08 18:52:15 +01:00
fanon 5d1644ba69 Simplify pawns King Safety calculation
STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 130209 W: 23516 L: 23581 D: 83112

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 33541 W: 4563 L: 4460 D: 24518

Bench: 8644370

Resolves #604
2016-03-27 20:08:56 +01:00
hxim 56dd58e6f9 Remove Weights
Removed remaining redundant weights for pawn structure,
passed pawns, space and king safety by redistributing them
into individual evaluation terms.

STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 15173 W: 2790 L: 2659 D: 9724

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 43433 W: 5936 L: 5846 D: 31651

Bench: 7156237

Resolves #586
2016-02-07 21:00:24 +00:00
Lyudmil Antonov 89723339d9 Assorted English grammar changes
No functional change

Resolves #567
2016-01-16 21:34:29 +00:00
lucasart aa31f7f096 Retire CenterBind
And compensate in the PSQT.

STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 27714 W: 5161 L: 5052 D: 17501

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 36354 W: 5008 L: 4909 D: 26437

Bench: 8603285

Resolves #556
2016-01-03 17:33:36 +00:00
Alain SAVARD 1de97337c2 Fine tuning of unsupported pawn penalty
Adjust the unsupported pawn penalty when the pawn is supporting 2 pawns
(for example g7 in f6-g7-h6)

Passed STC
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 23833 W: 4384 L: 4158 D: 15291

Passed LTC
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 42711 W: 5918 L: 5655 D: 31138

Bench: 8390233

Resolves #549
2016-01-03 14:15:29 +00:00
ppigazzini d4af15f682 Update AUTHORS and copyright notice
No functional change

Resolves #555
2016-01-02 09:43:51 +00:00
Marco Costalba 9742fb10fd Update Copyright year
No functional change.

Resolves #554
2016-01-01 10:17:36 +00:00
Alain SAVARD 6a79d5d10e Correct Pawn Trace Score + Code Clean up
No functional change

Resolves #542
2015-12-30 11:30:28 +00:00
Marco Costalba 52eac1e535 Simplify outpost code
Also inline defintions of SpaceMask and CenterBindMask.

Verified from assembly that compiler computes the values
at compile time, so it is also theoretical faster.

While there factor out scale factor evaluation.

No functional change.
2015-12-05 11:16:19 +01:00
Stefan Geschwentner cccf3c815c Bonus for reachable outpost
Give a bonus for outpost squares which in reach of a bishop or knight.

STC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 22725 W: 4570 L: 4339 D: 13816

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 15019 W: 2333 L: 2157 D: 10529

Bench: 8503181

Resolves #495
2015-11-14 06:31:45 -08:00
Alain SAVARD 55758344d3 Simplify threats
Using less parameters and code to compute Threats
Includes also a few spacing edits.

Run as a simplification.

Passed STC 10+0.1
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 18879 W: 3725 L: 3600 D: 11554

Passed LTC 60+0.4
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 74116 W: 11001 L: 10958 D: 52157

bench: 8004751
2015-10-24 10:08:26 +02:00
Stéphane Nicolet 7ea5659c5f Asymmetry bonus for the attacking side
Use asymmetry in the position (king separation, pawn structure) to
compute an "initiative bonus" for the attacking side.

Passed STC:
LLR: 2.95 (-2.94,2.94) [0.00,5.00]
Total: 14563 W: 2826 L: 2636 D: 9101

And LTC:
LLR: 2.96 (-2.94,2.94) [0.00,5.00]
Total: 14363 W: 2317 L: 2141 D: 9905

Bench: 8116244

Resolves #462
2015-10-15 21:27:52 -07:00
Marco Costalba e6310b3469 Rename Position::list
Use Position::square and Position::squares instead.

This allow us to remove king_square(), simplify
endgames and to have more naming uniformity.

Moreover, this is a prerequisite step in case
in the future we decide to retire piece lists
altoghter and use pop_lsb() to loop across
pieces and serialize the moves. In this way
we just need to change definition of Position::square
to something like:

template<PieceType Pt> inline
Square Position::square(Color c) const {
  return lsb(byColorBB[c]);
}

No functional change.
2015-08-04 09:51:06 +02:00
lucasart 5ebdf2f8c8 Tune pawn shelter/storm
STC
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 31679 W: 6183 L: 5912 D: 19584

LTC
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 43550 W: 6885 L: 6602 D: 30063

Bench: 9219343

Resolves #360
2015-06-02 12:09:19 -07:00