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

3113 commits

Author SHA1 Message Date
Marco Costalba
6e4b4c42ed Merge default tests in pos_is_ok
No functional change.
2014-03-15 15:34:31 +01:00
Marco Costalba
142874b058 Microptimize castling in undo_move()
We don't need to set 'captured' and 'pt' after we
castle back.

No functional change.
2014-03-15 11:47:30 +01:00
Mysseno
36c381154b Depth dependant aspiration window delta
Split delta value in aspiration window so that when
search depth is less than 24 a smaller delta value
is used. The idea is that the search is likely to
be more accurate at lower depths and so we can exclude
more possibilities, 25% to be exact.

Passed STC
LLR: 2.96 (-2.94, 2.94) [-1.50, 4.50]
Total: 20430 W: 3775 L: 3618 D: 13037

And LTC
LLR: 2.96 (-2.94, 2.94) [0.00, 6.00]
Total: 5032 W: 839 L: 715 D: 3478

Bench: 7451319
2014-03-14 19:47:41 +01:00
Marco Costalba
d0587f2c7f Use legal positions for endgame initialization
During endgame initialization we get the material
hash key of each endgame forging and ad-hoc position
that in same cases is illegal (leaves teh king under
capture). This is not a problem for the material key,
but rises an assert when SF is run in debug mode with
'testKingCapture' set in pos_is_ok().

So rewrite the code to always produce legal positions.

No functional change.
2014-03-14 09:57:34 +01:00
Marco Costalba
1f4798a173 Further work in pos_is_ok()
No functional change.
2014-03-14 09:43:19 +01:00
Daylen Yang
61e4443342 Re-add link time optimization on OS X
In the new version of clang, -O4 does not imply -flto, so we set the
flag
2014-03-14 08:49:08 +01:00
Marco Costalba
6571acffaa Reformat do_castling()
No functional change.
2014-03-13 12:53:03 +01:00
Marco Costalba
6f3d787692 Further merge StateInfo setup functions
No functional change.
2014-03-12 22:46:17 +01:00
Marco Costalba
1e032ece92 Merge hash key computation functions
No functional change.
2014-03-12 09:14:38 +01:00
Marco Costalba
cc3002ff04 Use std::count in pos_is_ok()
No functional change.
2014-03-11 23:19:47 +01:00
Marco Costalba
c40d4e0133 Small simplification in gives_check
Use switch statement also for normal case.

No speed regression.

No functional change.
2014-03-11 22:58:08 +01:00
Marco Costalba
ca0804dfe4 Print dbg counters after bench
Print last debug counters update just
before to exit benchmark.

Suggested by Stephane Nicolet.

No functional change.
2014-03-11 22:19:14 +01:00
Marco Costalba
d2a8ba3299 Simplify pseudo_legal()
Big simplification of pawn move check.

Code has been tested with a brute force approach: for
every position reached during a bench search, the function
has been called for each combinations of Move(from, to)
and verified the result is the same of old code.

Actually this function is very critical becuase is the
one that ensures corrupted TT moves are discarded, so
to properly test it a simple bench is not enough.

Verified also speed is not changed.

No functional chnage.
2014-03-10 08:38:23 +01:00
Marco Costalba
20ff12e1be Simplify generate<EVASIONS>
No speed regression, tested with both perft and
bench.

No functional change.
2014-03-09 12:16:27 +01:00
Marco Costalba
5cf9e0b254 Retire SERIALIZE macros
Explicitly write the 'while' loops. This adds some
code but makes clear what's the code behind the
macro.

No functional change.
2014-03-09 11:10:33 +01:00
Marco Costalba
1d1b7df7c6 Rename castling flag to castling right
This is a more conventional naming as
reported also in:

http://chessprogramming.wikispaces.com/Castling+rights

No functional change.
2014-03-08 15:08:55 +01:00
Stephane Nicolet
13b9e1e098 Fix dbg_mean_of() for negative numbers
Type should be int64_t instead of uint64_t

No functional change.
2014-03-05 08:55:12 +01:00
mstembera
553ead429d Some minor cleanup stuff
I came across while browsing the code.

No functional change.
2014-03-03 08:57:20 +01:00
Marco Costalba
bbd69c0260 Revert dynamic draw value
When tested with weaker engines did not
performed as expected, actually it was even
a regression from standard version.

bench: 8430785
2014-03-03 08:39:34 +01:00
Marco Costalba
708cb311a0 Pass CastlingFlag argument only
Instead of Color and CastlingSide. Change functions API
accordingly.

No functional change.
2014-03-02 13:21:19 +01:00
Marco Costalba
3e5470d88f Remove limit of minimumSplitDepth
There is no reason why an user cannot set
it at a value less than 4.

No functional change.
2014-03-01 23:22:14 +01:00
Marco Costalba
3d8c0f16c2 Rename xxx_to_char() -> to_char()
No functional change.
2014-03-01 22:07:41 +01:00
Marco Costalba
de2ba70830 Simplify Bitboards::pretty
No functional change.
2014-03-01 13:10:05 +01:00
Marco Costalba
9f0485e343 Retire UCI_AnalyseMode option
It has been obsoleted out already some time ago
and currently there is no point in changing eval
score according to if we are in game or analyzing.

So retire the option.

No functional change.
2014-03-01 12:10:42 +01:00
Joerg Oster
b917cd275e Dynamic draw value
Try to avoid repetition draws at early midgame,
this should give an edge against weaker opponents
and reduce draw rate.

Tested for regressions with SPRT[-3, 1] and
passed both short TC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 68498 W: 12928 L: 12891 D: 42679

And long TC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 40212 W: 6386 L: 6295 D: 27531

bench: 7990513
2014-02-26 19:33:52 +01:00
Marco Costalba
0949f06a60 Fix a warning with Intel compiler
warning #2259: non-pointer conversion from "int" to
"uint8_t={unsigned char}" may lose significant bits

No functional change
2014-02-22 12:00:14 +01:00
Marco Costalba
012f20d66e Fix an assert in Probcut
When running the following position:

8/kPp5/2P3p1/p1P1p1P1/2PpPp2/3p1p2/3P1P2/5K2 w - - 0 1

An assert is raised at depth 92:

assert(-VALUE_INFINITE <= alpha && alpha < beta && beta <= VALUE_INFINITE);

This is because it happens that beta = 29832,
so rbeta = 30032 that is > VALUE_INFINITE

Bug spotted and analyzed by Uri, fix suggested by Joerg.

Other fixes where possible but this one is pointed
exactly at the source of the bug, so it is the best
from a code documentation point of view.

bench: 8430785
2014-02-22 10:38:21 +01:00
Leonid Pechenik
b8cfc255d4 Distribute part of first move time to other moves
Passed both short TC:
LLR: 2.97 (-2.94,2.94) [-1.50,4.50]
Total: 18907 W: 3475 L: 3322 D: 12110

And long TC:
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 19044 W: 2997 L: 2811 D: 13236

bench: 8430785
2014-02-20 08:39:00 +01:00
Marco Costalba
9fcefb2760 Avoid recalculating CheckInfo in generate_castling()
No functional change.
2014-02-20 08:27:13 +01:00
Marco Costalba
64a71c3c02 Don't update pieceCount for ALL_PIECES
It is currently unused and only adds
overhead for nothing.

Also set proper type of chess960.

No functional change.
2014-02-18 16:41:24 +01:00
Marco Costalba
7b0a2f2a90 Update SEE to return a Value
It seems more natural because the actual returned
value is from PieceValue[] array.

No functional change.
2014-02-16 13:06:31 +01:00
Marco Costalba
17ffc22279 Sync code style in material.cpp
Update to use common code style.

No functional change.
2014-02-16 12:56:54 +01:00
Marco Costalba
52ebf87238 Increase MAX_PLY from 100 to 120
Under some very rare case 100 plies of search
could be not enough. Increasing more could lead
to crashes due to reached stack size limit on
some platforms.

Strongly requested by Uri.

bench: 8430785
2014-02-16 12:20:37 +01:00
Marco Costalba
d91079d4b0 Fix material key for King
Currently king has no material key associated because
it can never happen to find a legal position without
both kings, so there is no need to keep track of it.

The consequence is that a position with only the two
kings has material key set at zero and if the material
hash table is empty any entry will match and this is
wrong.

Normally bug is hidden becuase the checking for a draw
with pos.is_draw() is done earlier than evaluate() call,
so that we never check in gameplay the material key of a
position with two kings.

Nevertheless the bug is there and can be reproduced setting
at startup a position with only two kings and typing
'eval' from prompt.

The fix is very simple: add a random key also for the king.

Also fixed the condition in material.cpp to avoid asserting
when a 'just 2 kings' postion is evaluated.

No functional change.
2014-02-16 11:51:30 +01:00
Marco Costalba
62c0dc5dea Restore PorbCut name
Actually MultiCut is too different from current scheme.
Note that neither ProbCut is exactly what we do because
we try just a handful of captures instead of all moves,
nevertheless it seems more in line with what we do.

Suggested by Joona.

No functional change.
2014-02-15 22:21:39 +01:00
Marco Costalba
7bdb8c9c5c Reformat of eval tracing code
Also assorted rename while there.

No functional change.
2014-02-15 14:11:26 +01:00
Marco Costalba
3336963185 Rename ProbCut to Multicut
The teqnique used is actually MultiCut:

https://chessprogramming.wikispaces.com/Multi-Cut

And not ProbCut:

https://chessprogramming.wikispaces.com/ProbCut

No functional change.
2014-02-15 09:37:55 +01:00
Marco Costalba
4808d15a85 Assorted renaming in search
Inspired by DON.

No functional change.
2014-02-15 09:20:27 +01:00
Joerg Oster
67f88f5e3e Return static eval when reaching MAX_PLY
Makes more sense than returning a draw score. Tested
with reduced MAX_PLY = 30 and passed both short TC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 17434 W: 3345 L: 3194 D: 10895

And long TC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 2610 W: 488 L: 373 D: 1749

With current limit of MAX_PLY = 100 the patch should not
introduce any measurable change, nevertheless is the correct
approach.

Idea of returning eval is from  Michel Van den Bergh.

bench: 8430785
2014-02-15 08:20:33 +01:00
Marco Costalba
b3470d7ab1 Fix magic boosters conversion
Fix small overflow error while converting
magic boosters from right rotate to left rotate,
in particular booster 38 was converted to 4122
instead of the corrcet value 26.

Formula used was:

s1 = original & 63, s2 = (original >> 6) & 63;
new = (64 - s1) | ((64 - s2) << 6);

Instead of:

s1 = original & 63, s2 = (original >> 6) & 63;
new = ((64 - s1) & 63) | (((64 - s2) & 63) << 6);

This has no impact in number of cycles needed, but
just in the resultig number that yields to a rotate
amount bigger than 63.

Spotted by Ehsan Rashid.

No functional change.
2014-02-14 10:43:37 +01:00
Marco Costalba
e4695f15bc Additional renaming from DON
Assorted renaming and triviality.

No functional change.
2014-02-14 09:42:50 +01:00
joergoster
ffd6685f79 Fix a compiler warning
Latest master triggers a compiler warning due
to comparing int64_t to uint64_t.

notation.cpp: In Funktion »std::string pretty_pv(Position&, int, Value, int64_t, Move*)«:
notation.cpp:230:30: Warnung: Vergleich zwischen vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken [-Wsign-compare]

This patch should fix it.

No functional change.
2014-02-12 21:52:21 +01:00
Leonid Pechenik
72e8640f4d Simplify time management
Tested with simplification mode SPRT[-4, 0]

Passed both short TC
LLR: 2.95 (-2.94,2.94) [-4.00,0.00]
Total: 34102 W: 6184 L: 6144 D: 21774

And long TC
LLR: 2.96 (-2.94,2.94) [-4.00,0.00]
Total: 16518 W: 2647 L: 2545 D: 11326

And also 40/10 TC
LLR: 2.95 (-2.94,2.94) [-4.00,0.00]
Total: 22406 W: 4390 L: 4312 D: 13704

bench: 8430785
2014-02-12 20:01:11 +01:00
Marco Costalba
e6523e56b8 Move magic random to RKISS
When initializing the magic numbers used to
compute sliding attacks, we endless generate a
random and test it as a possible magic.

In the general case this takes a lot of iterations,
but here, insteaad of picking a casual random, we
rotate it a couple of times and generate a number that
we know has a good probability to be a magic candidate.

This is becuase the quantities by which we rotate the
number are known in advance to produce quickly a good
canidate.

The patch, inspired by DON, just moves the shuffle to RKISS
changing the boosters to take in account a left rotation
instead of a right rotation as in the original.

No functional change.
2014-02-12 14:47:36 +01:00
Marco Costalba
b534176d4a Revert "Retire null search verification"
Although does not change ELO level, it seems
verification is useful in many zugzwang positions
as reported by many sources.

So revert this simplification.

bench: 8430785
2014-02-12 14:16:21 +01:00
Henri Wiechers
ddeb01612b Faster handling of king captures in Position::see
Another SEE speed up that passed the SPRT short TC test!

LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 81337 W: 15060 L: 14745 D: 51532

No functional change.
2014-02-09 19:42:24 +01:00
Marco Costalba
41641e3b1e Assorted tweaks from DON
Mainly renames and some little code style improvment,
inspired by looking at DON sources:

https://github.com/erashid/DON

No functional change.
2014-02-09 17:31:45 +01:00
Marco Costalba
2f5aaf7de6 Rewrite previous patch removing the macro
No functional change.
2014-02-08 13:27:44 +01:00
Thanar2
d48a304262 Inline common path of pos.gives_check
Test for common case which, when running default
stockfish bench, avoids 96% of 19 million calls to
pos.gives_check().

Yields to a 2-4% speed up according to platform.

Passed fishtest at STC
LLR: 2.97 (-2.94,2.94) [-1.50,4.50]
Total: 12441 W: 2333 L: 2196 D: 7912
http://tests.stockfishchess.org/tests/view/52f02d790ebc5901df50f887

Passed fishtest at LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 42175 W: 6702 L: 6409 D: 29064
http://tests.stockfishchess.org/tests/view/52f0dbe00ebc5901df50f8a0

No functional change.
2014-02-08 13:17:29 +01:00
Marco Costalba
0a1092f64e Don't fear races when are harmless
Actually race conditions do exist in an engine, just
think for a moment to TT concurrent access. Racy code
is not a problem per se, if the consequences are well
known and correctly handled.

In case of TT access we ensure that the TT move is validated
before to be tried, here we just retry the same move in less
that 1 case out of a million: this is totally harmless considering
that very probably the second time the move is tried we get
immediately a TT hit and search quickly returns.

So we simplify the code for no harm.

No fuctional change (in single thread case)
2014-02-08 13:07:57 +01:00