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

1410 commits

Author SHA1 Message Date
Marco Costalba
802ff4b379 DEBUG: Instrument with Gary's test code
To verify that the end position from the PV matches the
evaluation score after these changes

We need to temporarily disable the qsearch tt-value refinement,
as that will change the score returned.
2014-11-17 18:02:44 +01:00
Marco Costalba
792ae2c5a6 Accurate pv: don't need to set/reset (ss+1)->pv
No functional change.
2014-11-17 17:21:54 +01:00
Marco Costalba
478f62f9e6 Accurate pv: rename update_pv()
Explicitly set the current move and clearly
show that we copy into current pv starting
from position 1 and not zero.

No functional change.
2014-11-17 16:41:19 +01:00
Marco Costalba
881e184b94 Accurate pv: don't special case for RootNode
No functional change.
2014-11-17 16:37:23 +01:00
Marco Costalba
7a18e16fd4 Accurate pv: update pv in sync with alpha
This allow us to avoid checking for child.

bench: 7712200
2014-11-17 16:37:20 +01:00
Marco Costalba
5eee4d42ef Accurate pv: change update_pv() API
And call it consistently across search.

No functional change.
2014-11-17 16:37:11 +01:00
Marco Costalba
1a41157e76 Accurate pv: retire PVEntry
Use a simple array instead.

No functional change.
2014-11-17 16:37:08 +01:00
Marco Costalba
9c409a4efe Accurate pv: remove redundant check
We don't need to check for (i < MAX_PLY),
because search is already MAX_PLY limited.

No functional change.
2014-11-17 16:37:05 +01:00
Marco Costalba
7f83a93558 Accurate PV: codying style
No functional change.
2014-11-17 16:37:02 +01:00
lucasart
3b1f552b08 Half History Max
STC
LLR: 3.35 (-2.94,2.94) [-0.50,3.50]
Total: 17993 W: 3740 L: 3508 D: 10745

LTC
LLR: 3.25 (-2.94,2.94) [0.00,4.00]
Total: 21346 W: 3691 L: 3453 D: 14202

Bench: 7694316

Resolves #120
2014-11-17 07:04:58 +08:00
Marco Costalba
4840643fed Use DEPTH_MAX instead of MAX_PLY
When comparing to a Depth it is more
consistent to use DEPTH_MAX instead
of a int.

This is a subtle difference because we use
ply and depth almost interchangably in SF,
but they are different. FOr counting plies
makes ense to continue using ints, while
for Depth we have our specific enum.

This cleanly fixes a new Clang 3.5 warning:

No functional change.
2014-11-15 05:36:49 +01:00
Gary Linscott
4739037f96 100% accurate PV display
This gives SF accurate PVs, such that the evaluation of the leaf node in
the PV matches the score backed up to the root (99% of the time.
q-search will use the value stored in the hash table instead of the eval
value sometimes).

One drawback is that fail-high/low only get a minimal 2 move PV.

It doesn't add any additional overhead to the non-PV codepath except an
extra eight bytes to the SearchStack structure in multi-threaded
searches.

A core part of this is not pruning based on TT score in PV nodes. This
was measured as not being a regression at multiple TCs, except for one
exception, fast TC with huge hash, which is not realistic for longer
searches.

STC - 1 thread, 128 mb hash
ELO: 1.42 +-3.1 (95%) LOS: 81.9%
Total: 20000 W: 4078 L: 3996 D: 11926

STC - 3 thread, 128 mb hash
ELO: -3.60 +-2.9 (95%) LOS: 0.8%
Total: 20000 W: 3575 L: 3782 D: 12643

STC - 3 thread, 8 mb hash
ELO: 0.12 +-2.9 (95%) LOS: 53.3%
Total: 20000 W: 3654 L: 3647 D: 12699

LTC - 3 thread, 32mb hash
ELO: 2.29 +-2.0 (95%) LOS: 98.8%
Total: 35740 W: 5618 L: 5382 D: 24740

Bench: 6984058

Resolves #102
2014-11-12 16:16:33 -05:00
Marco Costalba
b777b17f6f Use if/else instead of goto
Real men jump/branch by hand...but
we prefer the humble way.

Moved also some uci info code where it
belongs, while there.

No functional change.

Resolves #110
2014-11-12 21:02:20 +00:00
Marco Costalba
db4b8ee000 Use Depth instead of int in search
And make it more ONE_PLY value independent,
although we are not there yet.

No functional change.

Resolves #111
2014-11-12 21:00:16 +00:00
lucasart
d709a5f1c5 Fix bounds of FutilityMoveCounts
This is a left-over from ONE_PLY == 2.

No functional change.

Resolves #107
2014-11-09 20:13:56 +00:00
Marco Costalba
1b0df1ae14 Retire pvMove in search()
Now we can directly replace it with
the definition resulting in simpler
and possibly faster code because
PvNode is evaluated at compile time.

No functional change.
2014-11-09 20:36:28 +01:00
Marco Costalba
57fdfdedcf Assorted code-style triviality
No functional change.
2014-11-09 20:17:29 +01:00
lucasart
8631b08d97 Codestyle massage Search::init()
* remove some erroneous comments, that were based on the ONE_PLY == 2.
* rename hd to d, because there's no more half-depth in SF.
* rescope variables into the for loops.
* reindent the for loops correctly.
* add a comment to explain the eval improving part (not so obvious to read
this code as array has 4 dimensions).

No functional change.
2014-11-08 10:56:51 -05:00
lucasart
3d2aab11d8 Be more optimistic in aspiration window
Be more optimistic wrt search instability, and set the unviolated bound
half window.

STC
LLR: 2.96 (-2.94,2.94) [-1.00,4.00]
Total: 16362 W: 3371 L: 3197 D: 9794

LTC
LLR: 2.94 (-2.94,2.94) [0.00,5.00]
Total: 21666 W: 3780 L: 3569 D: 14317

Bench: 6807896

Resolves #105
2014-11-08 10:47:56 -05:00
lucasart
7ebb872409 Prune ttMove like any other
This should reduce search inconsistencies, and doesn't seem to have a measurable ELO Impact:

STC with Hash=16
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 49264 W: 10076 L: 10007 D: 29181

LTC with Hash=64
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 82149 W: 14044 L: 14023 D: 54082

Plus an extra test, to make sure it doesn't regress with strong hash pressure:

STC with Hash=4
LLR: 2.95 (-2.94,2.94) [-4.00,0.00]
Total: 21498 W: 4327 L: 4246 D: 12925

Bench: 7302735

Resolves #100
2014-11-07 21:40:24 +00:00
Marco Costalba
bcbab19376 Assume UCI 'nodes' is int64_t instead of int
UCI specification is not clear on the size of
integers that are exchanged in the protocol, so
instead of a simple int, assume 'nodes' is a
int64_t because we need a bigger size to store
this value in many real cases, especialy with
very long searches.

No functional change.

Resolves #75
2014-11-05 21:11:05 +00:00
Marco Costalba
d29a68f585 Rearrange check_time()
Remove an ugly workaround for a gcc
warning while there.

No functional change.
2014-11-05 21:09:21 +00:00
lucasart
8ab9c2511a Cleanup MAX_PLY
This area has become obscure and tricky over the course of incremental
changes that did not respect the original's consistency and clarity. Now,
it's not clear why we use MAX_PLY = 120, or why we use MAX_PLY+6, among
other things.

This patch does the following:

* ID loop: depth ranges from 1 to MAX_PLY-1, and due to TT constraint (depth
must fit into an int8_t), MAX_PLY should be 128.

* stack[]: plies now range from 0 to MAX_PLY-1, hence stack[MAX_PLY+4],
because of the extra 2+2 padding elements (for ss-2 and ss+2). Document this
better, while we're at it.

* Enforce 0 <= ply < MAX_PLY:
  - stop condition is now ss->ply >= MAX_PLY and not ss->ply > MAX_PLY.
  - assert(ss->ply < MAX_PLY), before using ss+1 and ss+2.
  - as a result, we don't need the artificial MAX_PLY+6 range. Instead we
  can use MAX_PLY+4 and it's clear why (for ss-2 and ss+2).

* fix: extract_pv_from_tt() and insert_pv_in_tt() had no reason to use
MAX_PLY_PLUS_6, because the array is indexed by plies, so the range of
available plies applies (0..MAX_PLY before, and now 0..MAX_PLY-1).

Tested with debug compile, using MAX_PLY=16, and running bench at depth 17,
using 1 and 7 threads. No assert() fired. Feel free to submit to more severe
crash-tests, if you can think of any.

No functional change.
2014-11-03 23:36:24 +08:00
Pascal Romaret
f1359845de Improve compatibility with Shredder Classic GUI
This commit fixes two issues:

1) Don't print PVs after the search has been interrupted

    This solves the "mate 0 upperbound" scores that sometimes
    creep up when a multi-PV analysis gets interrupted with
    the `stop` command.

2) Print multipv before score

    Shredder Classic fails to identify the main PV
    (the one with multipv 1) if `score` comes first.
    This leads to an eval graph that doesn't reflect
    the scores actually reported by Stockfish when
    doing a multiPV analysis.

No functional change

Closes #76
2014-10-27 11:07:35 +00:00
Marco Costalba
2469daebb1 Final UCI helpers renaming
To reflect new changes, specifically that
now are all under UCI namespace.

No functional change.
2014-10-26 19:40:04 +00:00
Marco Costalba
aa60c80ade Retire notation.h
And move the few remaining content
under UCI namespace where they belong.

No functional change.
2014-10-26 19:39:56 +00:00
Marco Costalba
5cbcff55cc Rename ucioption.h to uci.h
We are going to add all UCI related
functions here, so first rename it
to a more proper name.

No functional change.
2014-10-26 19:39:46 +00:00
Luca Brivio
8a9b9ec96a Simplify futility move count array formula
No functional change
2014-10-05 12:49:18 +01:00
Marco Costalba
74829342ef Reformat and rename hash_after_move()
Align to standard coding style and properly use
enum types. Rename while there.

No functional change.
2014-10-04 10:36:29 +01:00
joergoster
82d065b011 Speculative prefetch
Idea by Peter Oesterlund.
Implemented and tested by Joerg Oester

STC 3 threads
ELO: 3.19 +-2.1 (95%) LOS: 99.9%
Total: 40000 W: 7576 L: 7209 D: 25215

LTC
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 22026 W: 3829 L: 3619 D: 14578

STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 7291 W: 1531 L: 1404 D: 4356

No functional change

Resolves #61
2014-10-02 22:19:14 +01:00
Marco Costalba
a1b62d68ec Trivial code style fixes
Mainly to sync mine and official repo.

No functional change.
2014-09-30 09:05:20 +02:00
Marco Costalba
222f59b9c1 Move ONE_PLY to be 1 instead of 2: search()
Now that half-plies are no more used we can simplify
the code assuming that ONE_PLY is 1 and no more 2.

Verified with a SMP test:
LLR: 2.95 (-2.94,2.94) [-4.50,0.00]
Total: 8926 W: 1712 L: 1607 D: 5607

No functional change.
2014-09-29 15:17:12 +02:00
lucasart
27a1877299 Clean up VALUE_KNOWN_WIN conditions
A patch (+ some extra changes) passed with:

STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 14575 W: 3101 L: 2967 D: 8507

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 42579 W: 7580 L: 7496 D: 27503

Bench: 6545733

Resolves #52
2014-09-28 17:45:49 +01:00
Uri Blass
ea9c424bba Remove use of half-ply reductions from LMR, Null-move, IID and
Singular extensions.

STC:
ELO: 3.80 +-3.1 (95%) LOS: 99.2%
Total: 19727 W: 4190 L: 3974 D: 11563

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 7647 W: 1356 L: 1214 D: 5077

Bench: 6545733

Resolves #55
2014-09-28 04:33:28 +08:00
Joona Kiiski
7ed15af371 Cap evaluation based null move extra reduction to three plies
It's a zero elo patch, and a reasonable safeguard against uncontrolled extreme reductions.

STC:
ELO: -0.08 +-2.0 (95%) LOS: 46.9%
Total: 40000 W: 6728 L: 6737 D: 26535

LTC:
ELO: -0.14 +-1.8 (95%) LOS: 44.0%
Total: 40000 W: 5557 L: 5573 D: 28870

Bench: 7201830
2014-09-25 20:42:25 +01:00
Uri Blass
d6613b7589 Change history reduction in LMR to be a full ply.
STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 9829 W: 2142 L: 1998 D: 5689

LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 27162 W: 4802 L: 4692 D: 17668

Bench: 7284120

Resolves #53
2014-09-26 02:22:39 +08:00
Marco Costalba
aa10d0aaa6 Rename "Contempt Factor" to "Contempt"
Suggested by Ronald and Lucas on talkchess.

No functional change.

Conflicts:
	src/ucioption.cpp
2014-09-16 21:14:00 +01:00
Marco Costalba
cd065dd584 Small tweak to idle_loop()
In case of a succesful late join we set again
'searching' flag, so we can restart search
immediately without an useless lock/unlock
cycle.

No functional change.
2014-09-04 20:19:03 +01:00
Joona Kiiski
95b24083fb Simplify idle_loop()
No functional change
2014-08-30 21:03:41 +01:00
lucasart
877313a413 Retire Search Log
No functional change

Bench: 7461881
2014-08-24 16:28:51 +01:00
Marco Costalba
8b8885ab07 Fix perft 1
Compute correct number of moves for this corner case.

A smal bug crept in after recent perft rework.

No functional change.
2014-08-10 07:36:22 +08:00
lucasart
a903ed07e0 Retire move_to_san()
Now "Write Search Log" will pring moves in UCI format, consistent with all the rest. This functionality is
not aimed at end-users anyway. It's hardly useful at all, in fact. Also, pretty-printing SAN moves is
something that better belongs in the GUI than in the engine.

No functional change.
2014-08-10 07:28:00 +08:00
Marco Costalba
a67c22611a Rework perft implementation
Unify various perft functions and move all the code
to search.cpp.

Avoid perft implementation to be splitted between
benchmark.cpp (where it has no reason to be) and
search.cpp

No functional and no speed change (tested).
2014-08-09 13:00:59 +08:00
Marco Costalba
1b69910865 Ensure printing UCI info in multi-pv case
After commit 94b1bbb68b, in case available root moves are less than multiPV, we
could never reach condition:

PVIdx + 1 == multiPV

and as a consequence UCI output is not printed.

Fixed suggested by Joerg Oster.

No functional change.
2014-08-02 22:16:45 +08:00
Marco Costalba
f2053ba19f Fix a warning with MSVC 2010
Warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data

No functional change.
2014-07-29 06:53:09 +08:00
lucasart
6b82a234d0 Aspiration: widen slower
STC:
LLR: -2.95 (-2.94,2.94) [0.00,4.00]
Total: 182323 W: 30664 L: 30234 D: 121425

LTC:
LLR: 3.51 (-2.94,2.94) [0.00,4.00]
Total: 59841 W: 8345 L: 8006 D: 43490

bench 7962536
2014-07-27 09:18:04 +08:00
Marco Costalba
94b1bbb68b Small reformat to Skill class
Steamline a bit the implementation of
skill levels. As a side effect we can
retire MultiPV global and use a local
variable instead.

No functional change.
2014-07-11 18:08:27 +08:00
lucasart
f133f61e3f Remove useless condition
Small simplification, suggested by Uri Blass.

passed STC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 25839 W: 4464 L: 4351 D: 17024

and LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 220039 W: 29981 L: 30131 D: 159927

No functional change.
2014-07-10 18:25:20 +08:00
Joona Kiiski
eb50793cff Retire FakeSplit
- Currently broken
    - Never been really useful
    - Does not work well with new splitting model

Verified for no regression at STC with 3 threads:
LLR: 2.96 (-2.94,2.94) [-6.00,0.00]
Total: 81905 W: 12122 L: 12381 D: 57402

No functional change
2014-07-09 07:19:06 +08:00
joergoster
ffedfa3354 Fix Singular extension condition to handle mate scores
With Eelco's patch "Don't special case for abs(beta) >= VALUE_MATE_IN_MAX_PLY" condition "abs(ttValue) < VALUE_KNOWN_WIN" has been removed from singular extension search, and condition "abs(beta) < VALUE_KNOWN_WIN" was added to the SingularExtensionNode definition.
This might lead to problems, especially in positions, where a mate is due.
For example, this position 5rk1/4K1pp/8/5PPP/8/8/8/1R6 w - - 12 1 triggers an assert.
stockfish: search.cpp:434: Value {anonymous}::search(Position&, Search::Stack*, Value, Value, Depth, bool) [with {anonymous}::NodeType NT = (<unnamed>::NodeType)2u; bool SpNode = false]: Assertion `-VALUE_INFINITE <= alpha && alpha < beta && beta <= VALUE_INFINITE' failed.

So let's re-insert the removed condition.
First spotted by Uri Blass, fix by me.

Bench: 8759675
2014-06-29 20:17:40 +01:00