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

419 commits

Author SHA1 Message Date
Marco Costalba
cca34e234c Drop 'is' prefix from query functions
Most but not all.

No functional change.
2013-09-28 06:47:59 -07:00
Marco Costalba
d50b33cacd Fix a silly unstoppable eval bug
The logic is broken for black side because we get more bonus
for pawn in 7th rank than for pawn in 2nd rank!

Spotted by Reuven Peleg

bench:3884409
2013-09-16 23:59:37 +02:00
Marco Costalba
af750bd2ef Rewrite unstoppable pawns evaluation
Instead of current code, give a bonus according to the frontmost
square among candidate + passed pawns.

This is a big simplification that removes a lot of accurate code
substituting it with a statistically based one using the common
'bonus' scheme, leaving to the search to sort out the details.

Results are equivalent but code is much less and, as an added bonus,
we now store candidates bitboard in pawns hash and allow this
info to be used in evaluation. This paves the way to possible
candidate pawns evaluations together with all the other pieces,
as we do for passed.

Patch passed short TC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 16927 W: 3462 L: 3308 D: 10157

Then failed (quite quickly) at long TC
LLR: -2.95 (-2.94,2.94) [0.00,6.00]
Total: 8451 W: 1386 L: 1448 D: 5617

But when ran with a conclusive 40K fixed games at 60 secs it proved
almost equivalent to original one.

ELO: 1.08 +-2.0 (95%) LOS: 85.8%
Total: 40000 W: 6739 L: 6615 D: 26646

bench: 3884003
2013-09-16 08:57:37 +02:00
Reuven Peleg
21cbfafc03 Code style at passed pawn eval
No functional change.
2013-09-15 21:49:06 +02:00
Kojirion
a71209868b Use pre-increment also for native types
Now that we use pre-increment on enums, it
make sense, for code style uniformity, to
swith to pre-increment also for native types,
although there is no speed difference.

No functional change.
2013-09-15 09:17:21 +02:00
Marco Costalba
7a1ff6d8ff Fix operator++ definition
ENABLE_OPERATORS_ON has incorrect definitions of
post-increment and post-decrement operators.

In particularly the returned value is the variable
already incremented/decremented, while instead they
should return the variable _before_ inc/dec.

This has no real effect because are only used in loops
and where the returned value is never used, neverthless
it is wrong. The fix would be to copy the variable to a
dummy, then inc/dec the variable, then return the dummy.

So instead, rename to pre-increment that can be implemented
without the dummy, actually the current implementation
it is already the correct pre-increment, with the only change
to return a reference (an l-value) and not a copy, so
to properly mimic the pre-increment on native integers.

Spotted by Kojirion.

No functional change.
2013-09-15 09:09:06 +02:00
Reuven Peleg
fc17d0de77 Increase passed bonus for having more pieces
Passed both short TC:
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 36463 W: 7575 L: 7365 D: 21523

And long TC:
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 2953 W: 564 L: 446 D: 1943

bench: 3846852
2013-09-13 18:08:22 +02:00
Reuven Peleg
bebd6e16f6 Simplify unstoppable pawns evaluation
No functional change
2013-09-10 23:02:05 +02:00
Reuven Peleg
4d90aeb0ab More readable space mask
No functional change.
2013-09-10 19:18:10 +02:00
homoSapiensSapiens
03cd049c68 Change condition to use relative rank
No functional change
2013-09-10 00:47:31 +02:00
Marco Costalba
0515ad0fb0 Remove unreachable values in mobility table
The possible maximum mobility cardinality (plus one in case of
zero squares available) is:

- Knights: max. 8  squares -> max. 9  entries
- Bishops: max. 13 squares -> max. 14 entries
- Rooks:   max. 14 squares -> max. 15 entries
- Queen:   max. 27 squares -> max. 28 entries

So remove the extra entries in the table.

Spotted by Dariusz Orzechowski.

No functional change.
2013-09-07 18:25:24 +02:00
homoSapiensSapiens
4b9e338541 Bonus for rook behind a passed
If our rook is behind a passed pawn, all
squares are defended.

One of the longest tests to pass !

Passed both short TC
LLR: 2.97 (-2.94,2.94)
Total: 44560 W: 9518 L: 9281 D: 25761

And long TC
LLR: 2.96 (-2.94,2.94)
Total: 61348 W: 11618 L: 11192 D: 38538

bench: 3787694
2013-08-29 22:53:21 +02:00
homoSapiensSapiens
a0cf424cfc Replace hardcoded 128 by constant
No functional change.
2013-08-29 13:59:49 +02:00
Marco Costalba
27e9fc1067 Normalize "pawn in front of minor" patch
No functional change.
2013-08-17 11:05:55 +02:00
homoSapiensSapiens
e005270fb6 Use constants arguments where possible
No functional changes.
2013-08-16 09:57:21 +02:00
Tom Vijlbrief
bd8f463b7e Bonus for a pawn in front of knight/bishop
Idea originated from a post of Don Dailey
on talkchess and reported by Eelco.

This is the last succesful attempt of a long
series of trials (as usually happens, the
'idea' alone is not enough).

Passed both short 15secs TC
LLR: 2.97 (-2.94,2.94)
Total: 7629 W: 1645 L: 1515 D: 4469

And long 60secs TC
LLR: 2.96 (-2.94,2.94)
Total: 10218 W: 1932 L: 1775 D: 6511

bench: 4944581
2013-08-13 14:20:02 +02:00
Marco Costalba
15616ad199 Don't set Search::RootColor in Eval::trace
Search::RootColor is a global parameter set
before to start a search, it is not something
trace() should change.

This patch allows to add trace() calls, for
debugging, inside search itself without altering
the bench, and also ensures that the values
returned by trace() and evaluate() are fully
equivalent.

No functional change.
2013-08-11 07:02:50 +02:00
Marco Costalba
94a3608ab9 Fix GrainSize rounding error
The rounding formula is different between
positive and negative scores due to the
GrainSize/2 term that is asymmetric.

So use truncation instead of rounding. This
guarantees that evaluation is rounded to zero
in the same way for both positive and negative
scores.

Found with position's flip

bench: 4634244
2013-08-10 17:11:13 +02:00
Marco Costalba
1f40cd6d02 Small renaming
No functional change.
2013-07-29 19:32:59 +02:00
Marco Costalba
b0fd2b6b98 Revert "Halve king eval margin"
This reverts commit 4b3a0fdab0.

As Gary says: " It failed when I tried it at long TC previously, and only
barely passed this time.  Some anecdotal evidence is that it hurts vs other
engines as well (the Lightspeed rating list showed a 16 elo drop from previous
best version - still +- 5 error bars on both, but that's still significant)"

I also agree that if we have some doubts (like in this case) it is better to
be safe than sorry.

bench: 4615572
2013-07-24 07:46:25 +02:00
Marco Costalba
ee5514b8fd Small simplification in space eval scoring
No functional change.
2013-07-19 11:13:18 +02:00
homoSapiensSapiens
4b3a0fdab0 Halve king eval margin
But still keep the same original
margin for score.

Passed both short TC test
LR: 2.95 (-2.94,2.94)
Total: 3710 W: 845 L: 726 D: 2139

And long TC
LLR: 2.95 (-2.94,2.94)
Total: 57859 W: 10939 L: 10532 D: 36388

bench: 4769737

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2013-07-19 08:16:39 +02:00
Marco Costalba
cbb1a8ed31 Better annotate unlikely conditions
And in case of gcc we win also a small
speed optimization due to better branch
prediction.

No functional change.
2013-07-15 21:01:02 +02:00
Marco Costalba
9749f1f14c Fix build on Intel compiler
Due to a strange issue (bug?) the ternary
operator does not return a BitCountType for
icc, so revert to the expression used
before bcbc9bfd1f

No functional change.
2013-07-13 23:13:30 +02:00
Marco Costalba
4ede49cd85 Fully qualify memset and memcpy
And other trivial touches.

Ispired by Lucas's DiscoCheck

No functional change.
2013-07-13 18:01:13 +02:00
Tom Vijlbrief
6960f41e03 Retire enoughMaterial + lower trapped rook threshold
Here speed up is the name of the game.

Speed up is gained:

- Removing the useless enoughMaterial code

- Limiting trapped rook evaluation to where it counts

Tested at long TC:
LLR: 2.97 (-2.94,2.94)
Total: 10061 W: 1948 L: 1790 D: 6323

bench: 4558173
2013-07-13 18:01:03 +02:00
Marco Costalba
12c0dfc113 Revert "Remove confusing optimization"
This reverts commit e05c80a088.

we gain a speed up of 1.5% under gcc !

No functional change.
2013-07-02 20:12:57 +02:00
Marco Costalba
a4c11b71ac Retire in_front_bb(Color c, Square s) overload
Explciitly call rank_of() in the few places where
it is used.

No functional change.
2013-06-23 10:16:43 +02:00
Marco Costalba
b2fadf32aa Retire ThisAndAdjacentFilesBB[]
It is unused. Also renamed attack_span_mask to
pawn_attack_span

No functional change.
2013-06-23 10:09:24 +02:00
Ryan Schmitt
e95e69515a Include file attacks in 'major on pawn'
Passed both short TC:
LLR: 2.97 (-2.94,2.94)
Total: 57846 W: 12248 L: 11974 D: 33624

And long one:
LLR: 2.95 (-2.94,2.94)
Total: 9181 W: 1732 L: 1581 D: 5868

bench: 4609948
2013-06-19 07:22:10 +02:00
Reuven Peleg
e05c80a088 Remove confusing optimization
Here we skip the call to pos.attacks_from<ROOK>(s) in the 98%
of cases, testing the first 2 members first. Unfortunatly
code is a bit triky and not clear. So we give up to the
speed optimization in exchange of more code clarity.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2013-06-17 18:12:15 +02:00
Marco Costalba
cd782c11ec Rename piece_count and piece_list
No functional change.
2013-06-16 13:21:10 +02:00
Marco Costalba
1fd020a8ba Use move_pawns() in Pawns::probe
And rename some stuff.

No functional change.
2013-06-16 10:40:36 +02:00
Marco Costalba
46409a7852 Assorted renaming in evaluation
And some reshuffle too.

No functional change.
2013-06-01 13:17:39 +02:00
jundery
d8b266af8b Passed pawn tuning
A small number of tests with simulated
annealing at 15s indicated these values
may be better

And this is verified at long 60+0.05 TC
LLR: 2.95 (-2.94,2.94)
Total: 40658 W: 7821 L: 7501 D: 25336

bench: 4931544
2013-05-31 09:17:48 +02:00
Marco Costalba
7222f47350 Re-add "Pawn Structure" UCI option
And reshuffle the code to not special case
this parameter.

No functional change.
2013-05-25 12:38:14 +02:00
Marco Costalba
eafb66e1aa More uniform tracing code
No functional change.
2013-05-25 12:01:50 +02:00
Uri Blass
d4a02b135d Bunch of 3 small patches
This patch is the sum of:

- Grainsize of 4 instead of 8

- Removing "depth < DEPTH_ZERO"

- Change DEPTH_QS_RECAPTURES = -5 to -7

All the patches individually failed to pass SPRT but scored
around 50%.

Together they pass easily short TC:
LLR: 2.96 (-2.94,2.94)
Total: 4429 W: 964 L: 844 D: 2621

And with some difficult long TC of 60+0.05:
LLR: 2.95 (-2.94,2.94)
Total: 64133 W: 11968 L: 11532 D: 40633

bench: 4821467
2013-05-23 17:59:39 +02:00
Uri Blass
7c6f346c90 Increased mobility array
Performed more or less well at short TC
LLR: 2.95 (-2.94,2.94)
Total: 50517 W: 9815 L: 9574 D: 31128

And a bit better at long TC
LLR: 2.96 (-2.94,2.94)
Total: 15564 W: 2805 L: 2624 D: 10135

bench: 4375253
2013-05-15 00:34:05 +02:00
Marco Costalba
1a34496761 Revert trapped rook bug fix
It seems that do  not limiting checking the
trapped rook only on rank 1 improves the
score.

At long TC
LLR: 2.97 (-2.94,2.94)
Total: 6581 W: 1346 L: 1204 D: 4031

bench: 4985012
2013-05-15 00:06:11 +02:00
Marco Costalba
19dd0de4ff Reformat previous patch
No functional change.
2013-05-13 20:42:44 +02:00
Marco Costalba
bcbc9bfd1f Some code reformat in evaluate_pieces
No functional change.
2013-05-11 11:13:06 +02:00
Marco Costalba
7eda7335fd Simplify previous patch
No functional change.
2013-05-09 19:09:51 +02:00
Marco Costalba
02606a8c83 Merge 'passed_pawns' tweaks
Good at both short and long TC

15+0.05
LLR: 2.96 (-2.94,2.94)
Total: 28220 W: 5531 L: 5349 D: 17340

TC 60+0.05
LLR: 2.95 (-2.94,2.94)
Total: 12612 W: 2221 L: 2057 D: 8334

bench: 4857939
2013-05-08 23:04:11 +02:00
Reuven Peleg
e7505324f6 Avoid explicit bitwise operators
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2013-05-05 22:51:18 +02:00
jundery
653c0527a7 Passed pawn eval
Use a stepped function to evaluate bonuses and add the bonus to the
middle game

bench: 4857939
2013-05-05 11:12:04 -06:00
Marco Costalba
0958e5c6d3 Simplify previous condition
No functional change.
2013-05-05 12:31:32 +02:00
Marco Costalba
9fc77bc414 Fix trapped rook condition
A rook is trapped if on rank 1 as is the king.
Currently the condition aloows for the rook
to be also in front of the pawns as long
as king is on first rank.

Verified with short TC test:
LLR: -1.71 (-2.94,2.94)
Total: 23234 W: 4317 L: 4317 D: 14600

Here what it counts is that after 23K games
result is equal.

bench: 4696542
2013-05-05 12:27:11 +02:00
Marco Costalba
3b92159908 Further simplify previous patch
No functional change.
2013-05-04 12:15:31 +02:00
homoSapiensSapiens
e00bb13e85 Merge some conditions
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2013-05-04 11:13:22 +02:00