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

3551 commits

Author SHA1 Message Date
Marco Costalba
a9e93fa6a5 Fully correct stealmate detection
In the (rare) cases when the two conditions
are true, then fully check again with a slow
but correct MoveList<LEGAL>(pos).size().

This is able to detect false positives like
this one:

8/8/8/Q7/5k1p/5P2/4KP2/8 b - - 0 17

When we have a possible simple pawn push that
is not stored in attacks[] array. Because the
third condition triggers very rarely, even if
it is slow, it does not alters in a measurable
way the average speed of the engine.

bench: 8678654
2014-05-03 12:12:22 +02:00
Marco Costalba
9e8bf82350 Add stealmate detection to evaluation
Currently a stealmate position is misevaluated
in a negative/positive score, this leads qsearch(),
that does not detects stealmates too, to return the
wrong score and this yields to some kind of endgames
to be completely misevaluated.

With this patch is fully fixed follwing position

7k/6p1/6B1/5K1P/8/8/8/8 w - - 0 1

Also in SMP case.

Correct root cause analysys by Ronald de Man.

bench: 8678654
2014-05-03 11:47:49 +02:00
Marco Costalba
dc87ec7258 Revert to Galurung's KBPsK endgame
After reverting to the original Tord's
endgame, a search on position

7k/6p1/6B1/5K1P/8/8/8/8 w - - 0 1

Reports, correctly, a draw score instead of
an advantage for white.

Issue reported by Uri Blass.

bench: 8678654
2014-05-02 11:04:18 +02:00
Marco Costalba
43973f43c6 Use only standard conforming eg_value()
Remove the optimization for Intel, is not
standard and can break at any time, moreover
our release build is not done with Intel C++
anymore so we don't need to sqeeze the extra
speed out from this compiler.

No functional change.
2014-05-01 23:08:07 +02:00
Marco Costalba
bee4f1cf09 Don't save stale value in TT after split
If we return from split with a stale value
due to a stop or a cutoff upstream occurred,
then we exit moves loop and save a stale value
in TT before returning search().

This patch, from Joona, fixes this.

bench: 8678654
2014-05-01 16:26:18 +02:00
Marco Costalba
da91a34c09 Better document search stop condition
Handling a stop or a cutoff in the search is
a tricky business, so better document this
difficult part of the code.

No functional change.
2014-05-01 08:48:59 +02:00
Marco Costalba
626dc8a03b Remove dead code in search
We can never have bestValue == -VALUE_INFINITE at
the end of move loop because if no legal move exists
we detect it with previous condition on !moveCount,
if a legal move exists we never prune it due to
futility pruning condition:

bestValue > VALUE_MATED_IN_MAX_PLY

So this code never executes, as I have also verified
directly.

Issue reported by Joona.

No functional change.
2014-05-01 07:46:44 +02:00
Marco Costalba
cf50e265fa Fix a compile error with Intel C++
Intel compiler is very picky:
"error: this operation on an enumerated type requires an
applicable user-defined operator function"

Reported by Tony Gaor.

No functional change.
2014-04-30 08:55:45 +02:00
snicolet
d3ffd0ffca Penalize hanging pieces
Passed both STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 8519 W: 1565 L: 1440 D: 5514

And LTC
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 60618 W: 9141 L: 8777 D: 42700

bench: 8678654
2014-04-30 08:36:44 +02:00
Marco Costalba
db229504e2 Rearrange interpolation formula
Put the division at the end to reduce
rounding errors. This alters the bench
due to different rounding errors, but
should not alter ELO in any way.

bench: 7615217
2014-04-28 17:27:49 +02:00
mstembera
918c29f83a Minor stuff scattered around
Just random minor stuff I found while browsing the code.

No functional change.
2014-04-28 17:07:43 +02:00
Marco Costalba
a1f39c1ef9 Remove other useless floor()
No functional change.
2014-04-27 19:17:40 +02:00
Marco Costalba
9f2a64abd2 Don't need floor() in timeman.cpp
For positive numbers result is equivalent:
http://stackoverflow.com/questions/3300290/cast-to-int-vs-floor

Spotted by Joseph Ellis.

No functional change.
2014-04-27 19:10:00 +02:00
Marco Costalba
93e3b06fe2 Fix Intel compiler warnings
Fallout from previous patch: Intel compiler
is very noisy.

No functional change.
2014-04-27 12:02:36 +02:00
Marco Costalba
86c20416c8 Remove some useless casts
No functional change.
2014-04-27 11:44:16 +02:00
Marco Costalba
c9e396b542 We can add an integer to a Value
We have defined corresponding operators,
so rely on them to streamline the code
and increase readibility.

No functional change.
2014-04-27 11:25:42 +02:00
Arjun Temurnikar
fe23f27086 Remove rook passers eval completely
Tested in no-regression mode.

Passed STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 17727 W: 3248 L: 3122 D: 11357

And (a very long!) LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 106327 W: 16258 L: 16265 D: 73804

bench: 7396783
2014-04-27 09:51:48 +02:00
Marco Costalba
de6fe2cb4e Reformatting in material.h
No functional change.
2014-04-27 09:31:22 +02:00
Marco Costalba
057c3d60cd Move game phase constants to enum Value
No functional change.
2014-04-27 09:23:45 +02:00
Marco Costalba
cb4ac4221e Speed up by almost 3%
This apparentely silly tweak allows
to speed up the bench by almost 3%.

Not clear why, repeating with perft,
the speed up vanishes.

Suggested by Jonathan Calovski.

No functional change.
2014-04-27 00:25:47 +02:00
Marco Costalba
55604f156b Fix issues detected by Coverity Scan
Most of Coverity Scan reports are false
positives, but in rare cases we have
confirmed (very small) issues.

No functional change.
2014-04-26 09:33:50 +02:00
Marco Costalba
7ddbcf7e87 Speed up picking of killers
Changing the order of the conditions gives
about 1% speed up!

No functional change.
2014-04-25 12:53:51 +02:00
Arjun Temurnikar
3705559fdb Remove RookOn7th and merge values into psqt
Tested in no-regression mode:

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 55678 W: 9954 L: 9892 D: 35832

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 9238 W: 1448 L: 1311 D: 6479

bench: 7905850
2014-04-24 08:53:46 +02:00
Arjun Temurnikar
6579a65bbb Remove penalty for knight when few enemy pawns
Tested in standard mode at STC and no-regression
mode at LTC:

STC
LLR: 2.97 (-2.94,2.94) [-1.50,4.50]
Total: 19503 W: 3502 L: 3349 D: 12652

LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 67474 W: 9974 L: 9921 D: 47579

bench: 8331217
2014-04-24 08:47:13 +02:00
Jonathan Calovski
f70cef3b79 Shuffle movepicker score
Believed to be a speed optimization as benched
on Windows with bench realtime affinity 0x1 deleting
highest and lowest runs:

Base	Test
1549259	1608202
1538115	1583934
1543168	1556938
1536365	1554179
1533026	1582010

Signature remains unchanged and gives anywhere from 1-2% nps
boost in analysis depending on number of cores used.

No functional change.
2014-04-24 08:38:11 +02:00
Marco Costalba
a89b26bedd Correctly apply previous patch
Apply the correct values from previous patch.

bench: 8082049
2014-04-24 08:35:13 +02:00
joergoster
8bfb53efe2 Move queen vs. 3 minors rule to imbalance tables
Tuned with CLOP after 57k games.

Simplification: tested in no-regression mode.

Passed both STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 17254 W: 3159 L: 3032 D: 11063

And LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 32413 W: 4967 L: 4864 D: 22582

bench: 8082049
2014-04-23 08:51:34 +02:00
Marco Costalba
a66e6e5ad9 Revert "Generalize shift_bb() to handle double pushes"
Seems to intorduce some compiler warning as
reported by Gary. Warning seems bogus, but
revert anyhow.

No functional change.
2014-04-21 20:56:12 +02:00
Marco Costalba
56273fca1e Reset DrawValue[] before new search
Spotted by Ronald de Man

bench: 7384368
2014-04-21 14:30:27 +02:00
Leonid Pechenik
ef43e6b05d Rise contempt when in advantage
This is a very discussed patch with many
argumentations pro and against. The fact is
it passed both STC:

LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 16305 W: 3001 L: 2855 D: 10449

And LTC
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 34273 W: 5180 L: 4931 D: 24162

Although it is true that a correct test should
include foreign engines, we commit it anyhow so
people can test it out in the wild, under broader
conditions.

bench: 7384368
2014-04-21 12:23:03 +02:00
Marco Costalba
223ebe7b40 Streamline implementation of Position::pretty()
Simpler and more in line with Bitboards::pretty()

No functional change.
2014-04-21 11:47:01 +02:00
Stefan Geschwentner
0e8ad40ef0 Raise penalty blocked enemy pawn on 6th rank
Idea from Lyudmil Tsvetkov.

The value seems to be raised a bit abruptly, but as
Gary said, a blocked pawn on the sixth rank has been
instrumental in limiting king mobility in multiple
losses that I've seen from SF. A blocked pawn on fifth
rank is much less serious on the king safety impact.

Passed both STC
LLR: 2.97 (-2.94,2.94) [-1.50,4.50]
Total: 14551 W: 2750 L: 2607 D: 9194

and LTC
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 43595 W: 6917 L: 6618 D: 30060

And even a retest at 60" fixed games 40K
ELO: 1.79 +-1.9 (95%) LOS: 97.0%
Total: 39889 W: 6018 L: 5813 D: 28058

bench: 7154916
2014-04-21 07:47:50 +02:00
Marco Costalba
eced15fe36 Generalize shift_bb() to handle double pushes
And use it in evaluate_space.

No functional change.
2014-04-20 15:52:37 +02:00
Arjun Temurnikar
a4d058bca2 Small simplification to passed pawns
Tested in no-regression mode.

Passed both STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 28521 W: 5066 L: 4958 D: 18497

And LTC
LLR: 3.04 (-2.94,2.94) [-3.00,1.00]
Total: 21939 W: 3261 L: 3138 D: 15540

bench: 8165681
2014-04-20 10:06:51 +02:00
Joseph Hellis
619d66b7ab Remove supporting pawns
Tested in no-regression mode

Passed both STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 44957 W: 7984 L: 7903 D: 29070

and LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 12396 W: 1916 L: 1783 D: 8697

Bench: 7907885
2014-04-17 08:45:31 +02:00
Jean-Francois Romang
9073866491 Enable BMI1 too when using BMI2 ARCH
Adding BMI1 allows the compiler to use _blsr_u64
automatically (the advertised 0.3% speed gain).
I verified that the compiler does not use this
instruction with the -mbmi2 flag only. Also, all
processors supporting BMI2 is also supporting BMI1.

No functional change
2014-04-14 07:54:24 +02:00
Marco Costalba
7bce8831d3 More readable trapped rook condition
Prefer

file_of(s) < file_of(ksq)

to the inidrect

file_of(ksq) < FILE_E

To evaluate if semiopen side to check is the left side.

Also other small touches while there.

No functional change.
2014-04-13 14:29:42 +02:00
Daylen Yang
81a8c1118b Simplify Makefile by removing OS X targets
Right now the Makefile is cluttered with OS X equivalents
of all the x86 targets. We can get rid of all of them and
just check UNAME against "Darwin" for the few OS X-specific
things we need to do.

We also disable Clang LTO when using BMI2 instructions. For
some reason, LLVM cannot find the PEXT instruction when using
LTO. I don't know why, but disabling LTO for BMI2 fixes it.

No functional change.
2014-04-13 09:05:21 +02:00
Marco Costalba
b2c0634d48 Move args parsing to UCI::loop
This leaves a very clean main.cpp

No functional change.
2014-04-12 13:51:52 +02:00
Marco Costalba
ada55c5d0a Reshuffle in uci.cpp
Move function definitions before call site.

No functional change.
2014-04-12 12:05:25 +02:00
Marco Costalba
17cb7e7fa3 Reshuffle in timeman.cpp
Move template definitions before call site.

No functional change.
2014-04-12 12:00:37 +02:00
Marco Costalba
800ba28e83 Fix a typo in evaluate
Spotted by Lyudmil Antonov.

No functional change.
2014-04-12 10:17:41 +02:00
Marco Costalba
0b2794ae12 Retire signature-build
Does not seem used.

No functional change.
2014-04-12 09:18:55 +02:00
Jean-Francois Romang
226bbc1e63 Add ARCH x86-64-bmi2 support
Intel Haswell and newer CPUs can calculate sliders
attacks using special PEXT asm instructions instead
of magic bitboards. This gives a +3% speed up.

To enable it just compile with ARCH=x86-64-bmi2

No functional change.
2014-04-12 09:15:14 +02:00
Marco Costalba
da2f8880b9 Switch to hardware PEXT
Retire software pext and introduce hardware
call when USE_PEXT is defined during compilation.

This is a full complete implementation of sliding
attacks using PEXT.

No functional change.
2014-04-12 08:55:30 +02:00
Marco Costalba
c556fe1d71 Implement PEXT based attacks
According to:

https://chessprogramming.wikispaces.com/BMI2#PEXTBitboards

No functional change.
2014-04-12 08:55:30 +02:00
Marco Costalba
2bfe61c33b Add PEXT software implementation
For development/debug purposes.

No functional change.
2014-04-12 08:55:30 +02:00
Marco Costalba
2f92e3b525 Big reshuffle in evaluate.cpp
Reshuffle functions to define them in reverse
calling order (C style).

This allow us to define templates before they are
used. Currently it is not like this, for instance
evaluate_pieces is defined after do_evaluate that
calls it. This happens to work for some strange
reason (two phase lookup?) but we want to avoid
code that works 'by magic'.

As a nice side-effect we can now remove the function
prototypes.

No functional change.
2014-04-12 08:39:18 +02:00
Gary Linscott
0510112f91 Move LowMobPenalty into psq/mobility tables
Tested in no-regression mode.

Passed both STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 36705 W: 6537 L: 6443 D: 23725

and LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 9358 W: 1495 L: 1358 D: 6505

bench: 6921356
2014-04-12 07:15:51 +02:00
Gary Linscott
4597324572 Reduce penalty for doubled pawns further away from each other
Passed both STC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 38339 W: 6849 L: 6649 D: 24841

and LTC
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 22693 W: 3455 L: 3256 D: 15982

bench: 7508468
2014-04-12 07:05:02 +02:00