]> git.sesse.net Git - stockfish/log
stockfish
9 years agoRearrange check_time()
Marco Costalba [Sat, 18 Oct 2014 05:44:08 +0000 (07:44 +0200)]
Rearrange check_time()

Remove an ugly workaround for a gcc
warning while there.

No functional change.

9 years agoAdd bonuses for each threat instead of max threat value.
Ajith [Tue, 4 Nov 2014 15:40:37 +0000 (23:40 +0800)]
Add bonuses for each threat instead of max threat value.

Use SPSA tuned values for all threat bonuses

STC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 6074 W: 1284 L: 1160 D: 3630

LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 13563 W: 2402 L: 2232 D: 8929

Bench: 6981908

Resolves #94

9 years agoOptimize TranspositionTable::store() and TranspositionTable::probe() for speed.
mstembera [Sat, 1 Nov 2014 05:48:19 +0000 (22:48 -0700)]
Optimize TranspositionTable::store() and TranspositionTable::probe() for speed.

No functional change.

Resolves #85

9 years agoDo not assume that enum are signed
lucasart [Mon, 3 Nov 2014 16:35:02 +0000 (00:35 +0800)]
Do not assume that enum are signed

Clang 3.5 issues warning on constructs like: abs(f1 - f2). The thing is that
f1 and f2 are enum types, and the range given (all positive) allows the
compiler to choose an unsigned type (efficiency being one reason to prefer
unsigned arithmetic). If f1 < f2 are unsigned, then f1 - f2 wraps around zero
and the abs() becomes a no-op. It's the reinterpretation of the unsigned
result (large value) as a signed int that happens to give the correct result,
thanks to 2's complement. This is all tricky and dangerous!

In the spirit of the standard, we assume nothing on the signedness of enums,
and simply calculate the rank and file distances as:
- rank_dist(r1, r2) = r1 < r2 ? r2 - r1 : r1 - r2
- file_dist(f1, f2) = f1 < f2 ? f2 - f1 : f1 - f2
this logic can in fact be applied to any enum we may use, so for better
generality and to avoid code duplication, we use a template function diff()
here.

No functional change.

Resolves #95

9 years agoCleanup MAX_PLY
lucasart [Mon, 3 Nov 2014 15:36:24 +0000 (23:36 +0800)]
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.

9 years agoRestore std::dec after std::hex
Marco Costalba [Sun, 2 Nov 2014 07:03:52 +0000 (08:03 +0100)]
Restore std::dec after std::hex

Code is leaking a std::hex, and causes subsequent
sync_cout output to be in hexadecimal.

Spotted by Lucas

No functional change.

9 years agoRetire ScalePawnSpan[]
Marco Costalba [Sat, 1 Nov 2014 21:18:15 +0000 (22:18 +0100)]
Retire ScalePawnSpan[]

Obscure, undocmented and misnamed array. Replace with
the direct formula: it is much more clear what the
code does.

No functional change.

Resolves #90

9 years agoMerge pull request #89 from official-stockfish/pull_no_pretty
Marco Costalba [Sat, 1 Nov 2014 21:24:33 +0000 (22:24 +0100)]
Merge pull request #89 from official-stockfish/pull_no_pretty

Prefer operator<<() to pretty()

No functional change.

9 years agoRetire PawnsFileSpan
Marco Costalba [Sat, 1 Nov 2014 17:15:07 +0000 (18:15 +0100)]
Retire PawnsFileSpan

It is useless. Tested as no regression:

STC
LLR: 4.06 (-2.94,2.94) [-3.00,1.00]
Total: 140718 W: 28527 L: 28568 D: 83623

LTC
LLR: 2.94 (-2.94,2.94) [-3.00,1.00]
Total: 60034 W: 10359 L: 10303 D: 39372

bench: 6564212

Resolves #88

9 years agoCorrectly describe POPCNT compile
lucasart [Sat, 1 Nov 2014 20:43:57 +0000 (20:43 +0000)]
Correctly describe POPCNT compile

SSE4.2 has nothing to do with POPCNT. We must dispell this myth, because
Stockfish is a reference and many will copy this mistake if they see it in Stockfish:
* SSE is an SIMD instruction set, relative to vectorization (using special 128-bit registers).
* POPCNT/LZCNT work on normal registers (eg. AL, AX, EAX, RAX).

The confusion comes from the fact that, in the Intel product line, it just
so happens that SSE4.2 and POPCNT/LZCNT came out at the same time. But this
is not true for AMD. For example, all AMD Pheniom II have SSE3 but no
POPCNT/LZCNT, and that is why the modern compile uses  -msse3 -popcnt and not -msse4.2.

No functional change.

Resolves #86

9 years agoConsistent use of anonymous namespace
lucasart [Sat, 1 Nov 2014 20:35:10 +0000 (20:35 +0000)]
Consistent use of anonymous namespace

Objects that are only accessible at file-scope should be put in the anonymous namespace.
This is what the  C++ standard recommends, rather than using static, which is really C-style and results in static linkage.

Stockfish already does this throughout the code. So let's weed out the few exceptions,
because... they have no reason to be exceptional.

No functional change.

Resolves #84

9 years agoRemove dead code
lucasart [Sat, 1 Nov 2014 20:16:29 +0000 (20:16 +0000)]
Remove dead code

No functional change.

Closes #87

9 years agoPrefer operator<<() to pretty()
Marco Costalba [Sat, 1 Nov 2014 17:50:27 +0000 (18:50 +0100)]
Prefer operator<<() to pretty()

It is more idiomatic, we didn't used it
in the past because Position::pretty(Move)
had a calling argument, but now we can.

As an added benefit, we avoid a lot of string
copies in the process because now we avoid
std::ostringstream ss.

No functional change.

9 years agoMerge pull request #82 from official-stockfish/clean_up_bishop_code
Marco Costalba [Sat, 1 Nov 2014 17:05:03 +0000 (18:05 +0100)]
Merge pull request #82 from official-stockfish/clean_up_bishop_code

Code style clean-up

No functional change.

9 years agoCode style clean-up
Marco Costalba [Thu, 30 Oct 2014 11:32:43 +0000 (12:32 +0100)]
Code style clean-up

This piece of code needs some love.

No functional change.

9 years agomax_piece_type cleanup, and slight speed increase.
mstembera [Tue, 28 Oct 2014 14:23:01 +0000 (22:23 +0800)]
max_piece_type cleanup, and slight speed increase.

No functional change.

Resolves #81

9 years agoA small clean up of previous patch suggested by Marco
Joona Kiiski [Mon, 27 Oct 2014 20:14:58 +0000 (20:14 +0000)]
A small clean up of previous patch suggested by Marco

No functional change

9 years agoSpeed up max_piece_type()
Joona Kiiski [Mon, 27 Oct 2014 14:05:24 +0000 (14:05 +0000)]
Speed up max_piece_type()

Write code in the way that allows compiler to perform loop unrolling.

My measurement (32 cycles each):

Orig:

Time (Mean: 2466.59375, Trimmed mean: 2464.25, Std: 12.6869487803348)
Nodes (Mean: 4294458, Trimmed mean: 4294458, Std: 0)
Speed (Mean: 1741.09247987678, Trimmed mean: 1742.72879715475, Std: 8.93612608292678)

Time (Mean: 2470.15625, Trimmed mean: 2468.75, Std: 12.7484581610433)
Nodes (Mean: 4294458, Trimmed mean: 4294458, Std: 0)
Speed (Mean: 1738.58176151341, Trimmed mean: 1739.54618465403, Std: 8.95585822316946)

Mod:

Time (Mean: 2449.90625, Trimmed mean: 2445.9375, Std: 12.1000116635508)
Nodes (Mean: 4294458, Trimmed mean: 4294458, Std: 0)
Speed (Mean: 1752.94829372932, Trimmed mean: 1755.75934908231, Std: 8.61478453124504)

Time (Mean: 2442.78125, Trimmed mean: 2441.1875, Std: 8.17839157228837)
Nodes (Mean: 4294458, Trimmed mean: 4294458, Std: 0)
Speed (Mean: 1758.03872783803, Trimmed mean: 1759.16825356261, Std: 5.81131316346191)

No functional change

9 years agoTune PawnsFileSpan
snicolet [Sun, 26 Oct 2014 23:08:56 +0000 (00:08 +0100)]
Tune PawnsFileSpan

Passed the following SPRT tests:

STC:
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 24428 W: 5056 L: 4880 D: 14492

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 26590 W: 4715 L: 4472 D: 17403

Bench: 6615949

Resolves #78

9 years agoImprove compatibility with Shredder Classic GUI
Pascal Romaret [Mon, 27 Oct 2014 11:07:35 +0000 (11:07 +0000)]
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

9 years agoFix an obscure gcc warning
Marco Costalba [Sun, 26 Oct 2014 07:14:36 +0000 (08:14 +0100)]
Fix an obscure gcc warning

warning: narrowing conversion from ‘int’ to ‘char’ inside { }
is ill-formed in C++11 [-Wnarrowing]

When pedantic meets esoteric!

No functional change.

9 years agoRetire notation.cpp
Marco Costalba [Sun, 26 Oct 2014 06:50:09 +0000 (07:50 +0100)]
Retire notation.cpp

Now we can finally retire notation.cpp
and move UCI helpers under uci.cpp

No functional change.

9 years agoFinal UCI helpers renaming
Marco Costalba [Sun, 26 Oct 2014 06:41:25 +0000 (07:41 +0100)]
Final UCI helpers renaming

To reflect new changes, specifically that
now are all under UCI namespace.

No functional change.

9 years agoRetire notation.h
Marco Costalba [Sun, 26 Oct 2014 06:16:16 +0000 (07:16 +0100)]
Retire notation.h

And move the few remaining content
under UCI namespace where they belong.

No functional change.

9 years agoRename ucioption.h to uci.h
Marco Costalba [Sun, 26 Oct 2014 06:09:19 +0000 (07:09 +0100)]
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.

9 years agoRetire to_char() helpers
Marco Costalba [Sun, 26 Oct 2014 05:52:30 +0000 (06:52 +0100)]
Retire to_char() helpers

Remove some useless wrappers and make
the conversion explicit and starightforward.

No functional change.

9 years agoReformat max_threat()
Marco Costalba [Sat, 25 Oct 2014 05:03:42 +0000 (07:03 +0200)]
Reformat max_threat()

Helper function should just know how to find the
biggest piece type in a bitboard. All the threat
logic and data shoud be in evaluate_threats().

This nicely separates the scope of the two functions
in a more consistent way and simplifies the code.

No functional change.

9 years agoCalculate maximum threat for hanging pieces
snicolet [Thu, 23 Oct 2014 17:10:11 +0000 (01:10 +0800)]
Calculate maximum threat for hanging pieces

Use the max_threat() helper function to estimate more precisely the
best hanging piece threat.  Also retunes the Threat array using SPSA.

STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 7598 W: 1596 L: 1468 D: 4534

LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 7896 W: 1495 L: 1350 D: 5051

Bench: 6816504

Resolves #73

9 years agoDocument why initing eval tables
Marco Costalba [Mon, 13 Oct 2014 07:23:21 +0000 (09:23 +0200)]
Document why initing eval tables

Instead of hard-code the weights in a big table,
we prefer to calculate them out of few parameters
at startup. This allows to keep low the number of
independent parameters and hence is good for tuning
and for a better insight in the meaning of the numbers.

No functional change.

9 years agoRename Tracing methods
Marco Costalba [Sat, 11 Oct 2014 07:52:16 +0000 (09:52 +0200)]
Rename Tracing methods

Easier to understand and more in line with
standard Trace classes naming like:

http://msdn.microsoft.com/en-us/library/system.diagnostics.trace.aspx

No functional change.

9 years agoAccount for Tempo in do_evaluate()
Marco Costalba [Sat, 11 Oct 2014 07:05:47 +0000 (09:05 +0200)]
Account for Tempo in do_evaluate()

This is more correct because we let evaluate()
to be a pure dispatcher and also now evaluate
and tracing outputs are consistent.

No functional change.

9 years agoFix some warnings with Intel C++ compiler
Marco Costalba [Sun, 5 Oct 2014 08:53:31 +0000 (10:53 +0200)]
Fix some warnings with Intel C++ compiler

No functional change.

9 years ago Further streamline connected pawn evaluation
lucasart [Sun, 12 Oct 2014 19:03:49 +0000 (20:03 +0100)]
 Further streamline connected pawn evaluation

Make even more clear what are the terms that
contribute to evaluate connected pawns, and
completely separate them from the weights
that are now fully looked up in a table.

For future tuning makes sense to init the table with
a formula instead of hard-code it. This allows to
reduce problem space cardinality and makes tuning
easier.

And fix a MSVC warning while there:
warning C4804: '>>' : unsafe use of type 'bool' in operation

No functional change.

9 years agoMerge Connected and Candidate
lucasart [Mon, 6 Oct 2014 11:26:30 +0000 (19:26 +0800)]
Merge Connected and Candidate

These two notions are very correlated. Since connected has the most
generality, it makes sense to generalize it to encompass what is
covered by candidate.

STC:
LLR: 4.03 (-2.94,2.94) [-3.00,1.00]
Total: 11970 W: 2577 L: 2379 D: 7014

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 13194 W: 2389 L: 2255 D: 8550

bench 7328585

9 years agoRemove the now redundant TT prefetch call from Position::do_move.
joergoster [Mon, 6 Oct 2014 15:59:04 +0000 (23:59 +0800)]
Remove the now redundant TT prefetch call from Position::do_move.

Tested for no regression and passed both
STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 48250 W: 9757 L: 9686 D: 28807

LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 51412 W: 8887 L: 8816 D: 33709

No functional change.

Resolves #66

9 years agoSimplify futility move count array formula
Luca Brivio [Sun, 5 Oct 2014 11:49:18 +0000 (12:49 +0100)]
Simplify futility move count array formula

No functional change

9 years agoReformat and rename hash_after_move()
Marco Costalba [Sat, 4 Oct 2014 04:07:55 +0000 (06:07 +0200)]
Reformat and rename hash_after_move()

Align to standard coding style and properly use
enum types. Rename while there.

No functional change.

9 years agoExtend King Threats to all pieces (other than pawns).
Ajith [Fri, 3 Oct 2014 19:54:12 +0000 (03:54 +0800)]
Extend King Threats to all pieces (other than pawns).

STC
LLR: 2.99 (-2.94,2.94) [-1.50,4.50]
Total: 20559 W: 4261 L: 4095 D: 12203

LTC
LLR: 2.96 (-2.94,2.94) [0.00,4.00]
Total: 75232 W: 13097 L: 12696 D: 49439

Bench: 7543790

Resolves #63

9 years agoSpeculative prefetch
joergoster [Thu, 2 Oct 2014 21:19:14 +0000 (22:19 +0100)]
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

9 years agoConvert TT depth to int8_t
lucasart [Wed, 1 Oct 2014 19:51:32 +0000 (20:51 +0100)]
Convert TT depth to int8_t

Now that half plies have been removed from the engine, we can encode
TT depth into an int8_t.

Range is -128 to +127, so it goes still further than the previous
limit of 121 plies (with ONE_PLY == 2 where depth - DEPTH_NONE was
encoded as an uint8_t).

No functional change.

Resolved #60

9 years agoTrivial code style fixes
Marco Costalba [Tue, 30 Sep 2014 07:05:20 +0000 (09:05 +0200)]
Trivial code style fixes

Mainly to sync mine and official repo.

No functional change.

9 years agoMove ONE_PLY to be 1 instead of 2: search()
Marco Costalba [Mon, 29 Sep 2014 12:08:56 +0000 (14:08 +0200)]
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.

9 years agoClean up VALUE_KNOWN_WIN conditions
lucasart [Sun, 28 Sep 2014 16:45:49 +0000 (17:45 +0100)]
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

9 years agoRemove use of half-ply reductions from LMR, Null-move, IID and
Uri Blass [Sat, 27 Sep 2014 20:33:28 +0000 (04:33 +0800)]
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

9 years agoCap evaluation based null move extra reduction to three plies
Joona Kiiski [Thu, 25 Sep 2014 19:42:25 +0000 (20:42 +0100)]
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

9 years agoChange history reduction in LMR to be a full ply.
Uri Blass [Thu, 25 Sep 2014 18:22:39 +0000 (02:22 +0800)]
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

9 years agoEvaluate king safety when no queen is present.
uriblass [Sun, 21 Sep 2014 17:32:47 +0000 (01:32 +0800)]
Evaluate king safety when no queen is present.

LLR: 2.97 (-2.94,2.94) [-1.50,4.50]
Total: 16657 W: 3547 L: 3391 D: 9719

LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 31258 W: 5664 L: 5403 D: 20191

Bench: 8331165

Resolves #51

9 years agoFix spacing.
Gary Linscott [Sun, 21 Sep 2014 17:27:34 +0000 (01:27 +0800)]
Fix spacing.

No functional change.

9 years agoRearrange evaluation constants definitions
Marco Costalba [Sat, 20 Sep 2014 08:19:21 +0000 (10:19 +0200)]
Rearrange evaluation constants definitions

Make them more uniform and consistent.

No functional change.

Conflicts:
src/evaluate.cpp

9 years agoRename time variable to reflect UCI parameters
Marco Costalba [Thu, 18 Sep 2014 13:44:38 +0000 (15:44 +0200)]
Rename time variable to reflect UCI parameters

On top of previous patch, rename time variables to
reflect the simplification of UCI parameters.

It is more correct to use as varibales directly the
corresponding UCI option, without intorducing redundant
intermediate variables.

This allows also to simplify the code.

No functional change.

9 years agoKing-pawn threat bonus for endgames.
mbootsector [Fri, 19 Sep 2014 14:33:42 +0000 (22:33 +0800)]
King-pawn threat bonus for endgames.

STC:
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 10224 W: 1765 L: 1638 D: 6821

LTC:
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 6923 W: 1027 L: 899 D: 4997

bench 7818100

Resolves #49

9 years agoRename "Contempt Factor" to "Contempt"
Marco Costalba [Mon, 8 Sep 2014 13:44:25 +0000 (15:44 +0200)]
Rename "Contempt Factor" to "Contempt"

Suggested by Ronald and Lucas on talkchess.

No functional change.

Conflicts:
src/ucioption.cpp

9 years agoRetire struct Log
Marco Costalba [Sun, 14 Sep 2014 08:06:36 +0000 (10:06 +0200)]
Retire struct Log

No more used now that we have removed
"Write Search Log" UCI option.

No functional change.

9 years agoSimplify Time Management UCI options
lucasart [Mon, 15 Sep 2014 19:24:51 +0000 (20:24 +0100)]
Simplify Time Management UCI options

No functional change

9 years agoSmall tweak to idle_loop()
Marco Costalba [Fri, 29 Aug 2014 12:59:32 +0000 (14:59 +0200)]
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.

9 years agoSimplify idle_loop()
Joona Kiiski [Sat, 30 Aug 2014 20:03:41 +0000 (21:03 +0100)]
Simplify idle_loop()

No functional change

9 years agoRetire Search Log
lucasart [Sun, 24 Aug 2014 15:28:51 +0000 (16:28 +0100)]
Retire Search Log

No functional change

Bench: 7461881

9 years agoFix perft 1
Marco Costalba [Sat, 9 Aug 2014 09:33:02 +0000 (11:33 +0200)]
Fix perft 1

Compute correct number of moves for this corner case.

A smal bug crept in after recent perft rework.

No functional change.

9 years agoRetire move_to_san()
lucasart [Sat, 9 Aug 2014 23:22:55 +0000 (07:22 +0800)]
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.

9 years agoMove to_char() and to_string() to notation
lucasart [Sat, 9 Aug 2014 05:11:36 +0000 (13:11 +0800)]
Move to_char() and to_string() to notation
Where they better belong.

Also, this removes '#include <string>' from types.h, which reduces the amount of code to compile (every
translation unit includes types.h).

No functional change.

9 years agoRework perft implementation
Marco Costalba [Fri, 8 Aug 2014 08:59:28 +0000 (10:59 +0200)]
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).

9 years agoWrite perft(N-1) into cout
lucasart [Thu, 7 Aug 2014 13:07:57 +0000 (21:07 +0800)]
Write perft(N-1) into cout
So that one can redirect cout to /dev/null and only print print cerr in the terminal (for more accurate speed
tests).

Suggested by Marco.

No functional change.

9 years agoFix Hash in bench
lucasart [Thu, 7 Aug 2014 10:51:07 +0000 (18:51 +0800)]
Fix Hash in bench
The compiler tries to cast Options["Hash"] into a string, using:

Option::operator std::string() const {
  assert(type == "string");
  return currentValue;
}

And, as expected, the assert() fails.

std::to_string() would be the right solution, but it's C++11. And using a stringstream is too much code to
achieve so little. Let's keep it the way it was: hardcoded (ie. default hash defined in two places).

No functional change.

9 years agoRemove insufficient material rule
joergoster [Wed, 6 Aug 2014 10:36:04 +0000 (18:36 +0800)]
Remove insufficient material rule
The eval already returns zero in KK, KBK, KNK (see material.cpp). The difference is:
- we lose the "TB pruning" benefit of the draw rule (ie. search goes on even if eval is zero)
- we gain some speed by removing a useless test from the hot path

STC:
LLR: 0.05 (-2.94,2.94) [-3.00,1.00]
Total: 128000 W: 21357 L: 21560 D: 85083

LTC:
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 33023 W: 4613 L: 4509 D: 23901

bench 7461881

9 years agoRemove useless code in Position::pretty()
lucasart [Tue, 5 Aug 2014 23:04:27 +0000 (07:04 +0800)]
Remove useless code in Position::pretty()
First, remove some dead code (function never called with a Move argument).

Then, remove printing of legal moves, which does not belong here. Let's keep commands orthogonal and minimal:
- the "d" command should display the board, nothing more, or less.
- "perft 1" will display the list of legal moves.

No functional change.

9 years agoReduce minimum memory requirement by 16MB
lucasart [Tue, 5 Aug 2014 03:42:48 +0000 (11:42 +0800)]
Reduce minimum memory requirement by 16MB
Stockfish allocates the default hash (32MB) in main(), before entering UCI::loop(). If there is not enough
memory, the program will crash even before UCI::loop() is entered and the GUI is given a change to specify a
lower Hash value.

This defective design could be resolved by doing a lazy allocation upon "isready" command, as the UCI protocol
guarantees that "isready" will be sent at least once before any search. But it's a bit cumbersome when using
Stockfish "manually" to have to remember to type "isready" everytime.

So leave the current design, but reduce the default hash to 16MB instread of 32MB. In order to perform such
quick searches (depth=13), there is no reason to use so much Hash anyway. Another benefit is to introduce a
bit of hash pressure in bench, which increases chances to detect rare bugs related to TT replacement, for
example.

This is not a functional change, although it obviously changes the bench.

bench 7461879

9 years agoDefault Hash defined in a single place
lucasart [Tue, 5 Aug 2014 03:39:50 +0000 (11:39 +0800)]
Default Hash defined in a single place
Instead of defining it both in ucioption.cpp and benchmark.cpp. Obviously changing the default Hash will
change the bench as a result.

No functional change.

9 years agoRetire divide command
lucasart [Mon, 4 Aug 2014 05:54:09 +0000 (13:54 +0800)]
Retire divide command
The main purpose of perft is to help debugging. But without the breakdown in sum of perft(N-1), it is a
completely useless debugging tool.

So perft now displays the breakdown, and divide is therefore removed.

No functional change.

9 years agoEnsure printing UCI info in multi-pv case
Marco Costalba [Sat, 2 Aug 2014 09:02:13 +0000 (11:02 +0200)]
Ensure printing UCI info in multi-pv case

After commit 94b1bbb68be6b0bc3aaf1cb804841a022bcc7007, 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.

9 years agoCorrect bench timing
Oskar Werkelin Ahlin [Fri, 1 Aug 2014 11:32:53 +0000 (19:32 +0800)]
Correct bench timing

No functional change.

9 years agoDocument Threat[] indices
lucasart [Mon, 28 Jul 2014 23:05:12 +0000 (07:05 +0800)]
Document Threat[] indices
From Marco's repo.

No functional change.

9 years agoFix a warning with MSVC 2010
Marco Costalba [Sat, 26 Jul 2014 14:01:09 +0000 (16:01 +0200)]
Fix a warning with MSVC 2010

Warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data

No functional change.

9 years agoSmall code style reformatting
David Zar [Sun, 27 Jul 2014 14:27:53 +0000 (17:27 +0300)]
Small code style reformatting

No functional change.

9 years agoAspiration: widen slower
lucasart [Sun, 27 Jul 2014 01:05:28 +0000 (09:05 +0800)]
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

9 years agoOutpost tuning
David Zar [Tue, 22 Jul 2014 23:05:10 +0000 (07:05 +0800)]
Outpost tuning
double mg bonus and half eg bonus.

STC:
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 18142 W: 3094 L: 2948 D: 12100

LTC:
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 83561 W: 11706 L: 11329 D: 60526

bench 7831429

9 years agoRevert Contempt = 20
lucasart [Sun, 20 Jul 2014 00:50:54 +0000 (08:50 +0800)]
Revert Contempt = 20

Despite being neutral at STC, it turned out to be regressive at LTC:

40k games at LTC with Hash=8
ELO: -2.06 +-1.9 (95%) LOS: 1.4%
Total: 39720 W: 5740 L: 5976 D: 28004

40k games at LTC with Hash=128
ELO: -2.69 +-1.9 (95%) LOS: 0.2%
Total: 39149 W: 5702 L: 6005 D: 27442

bench 7477963

9 years agoSimplify evaluate_passed_pawns
Marco Costalba [Mon, 14 Jul 2014 13:15:07 +0000 (15:15 +0200)]
Simplify evaluate_passed_pawns

From a suggestion by David Zar.

No functional change.

9 years agoContempt = 20
lucasart [Mon, 14 Jul 2014 23:03:37 +0000 (07:03 +0800)]
Contempt = 20
Also raise the admissible bounds to (-100,100), as there is no reason to prevent users from using high
values if they want to.

Does not regress in self play:
ELO: 0.10 +-2.0 (95%) LOS: 53.7%
Total: 40000 W: 7084 L: 7073 D: 25843

master vs SF 3
ELO: 182.86 +-2.7 (95%) LOS: 100.0%
Total: 40000 W: 21843 L: 2541 D: 15616

Contempt = 20 vs SF 3
ELO: 189.25 +-2.8 (95%) LOS: 100.0%
Total: 40000 W: 22721 L: 2859 D: 14420

Diff is therefore 6.4 +/- 3.9 elo against a 180-190 elo weaker engine, which is significantly positive,
as expected. This elo difference is likely understated, because of FishTest aggressive draw adjudication
though.

We could push Contempt further, but after 20cp, it would get in the way of FishTest draw adjudication
rule, and is likely to reduce the testing throughput as a result.

bench 8198667

9 years agoBonus passed pawn blocked by our pieces
David Zar [Mon, 14 Jul 2014 10:26:25 +0000 (18:26 +0800)]
Bonus passed pawn blocked by our pieces

passed STC:
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 63965 W: 10950 L: 10692 D: 42323

and LTC:
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 19237 W: 2740 L: 2562 D: 13935

bench: 7477963

9 years agoSmall reformat to Skill class
Marco Costalba [Thu, 10 Jul 2014 14:40:10 +0000 (16:40 +0200)]
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.

9 years agoRemove useless condition
lucasart [Thu, 10 Jul 2014 10:25:20 +0000 (18:25 +0800)]
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.

9 years agoRetire FakeSplit
Joona Kiiski [Mon, 7 Jul 2014 19:37:06 +0000 (20:37 +0100)]
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

9 years agoAvoid 'double assigments' tricks
Marco Costalba [Sat, 5 Jul 2014 06:15:57 +0000 (08:15 +0200)]
Avoid 'double assigments' tricks

Bitboard init code is already noteasy to follow,
so don't make it even harder using 'smart' code.

Also reindent a while loop in standard way.

No functional change.

9 years agoTune trapped rook penalty
joergoster [Thu, 3 Jul 2014 11:38:54 +0000 (19:38 +0800)]
Tune trapped rook penalty

Passed STC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 15687 W: 3352 L: 3199 D: 9136

and LTC (parameter tweaks)
LLR: 2.95 (-2.94,2.94) [0.00,4.00]
Total: 27983 W: 5046 L: 4797 D: 18140

bench: 8330705

9 years agosize_t cast in TranspositionTable::first_entry()
lucasart [Thu, 3 Jul 2014 10:23:56 +0000 (18:23 +0800)]
size_t cast in TranspositionTable::first_entry()
32-bit truncation would make this function bogus when clusterCount >= 2^33 (ie. Hash >= 256 GB).

No function change.

9 years agoUse compiler intrinsic instead of assembly for popcnt
lucasart [Thu, 3 Jul 2014 10:22:53 +0000 (18:22 +0800)]
Use compiler intrinsic instead of assembly for popcnt
This time, do not break compatibility with some AMD machines that have SSE3 and popcnt, but do
not have SSE4.2.

No functional change.

9 years agoRevert "Use compiler intrinsic instead of assembly for popcnt"
Gary Linscott [Tue, 1 Jul 2014 21:01:54 +0000 (17:01 -0400)]
Revert "Use compiler intrinsic instead of assembly for popcnt"

This reverts commit a69f1d7c2060dc7b320a7b4801105df00b22a96a.

9 years agoUse compiler intrinsic instead of assembly for popcnt
lucasart [Tue, 1 Jul 2014 12:46:16 +0000 (20:46 +0800)]
Use compiler intrinsic instead of assembly for popcnt
No functional change.

9 years agoRaise max Hash to 1TB
lucasart [Tue, 1 Jul 2014 10:13:20 +0000 (18:13 +0800)]
Raise max Hash to 1TB
And use size_t where appropriate, as suggested on FishCooking.

No functional change.

9 years agoAdd bonuses for Minors attacking enemy pieces(except pawns) even when they are protec...
Ajith [Mon, 30 Jun 2014 14:55:10 +0000 (10:55 -0400)]
Add bonuses for Minors attacking enemy pieces(except pawns) even when they are protected by enemy pawns.

Patch passed STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 8206 W: 1426 L: 1304 D: 5476

and LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 19534 W: 2821 L: 2640 D: 14073

Bench: 9942172

9 years agoFix Singular extension condition to handle mate scores
joergoster [Sun, 29 Jun 2014 19:17:40 +0000 (20:17 +0100)]
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

9 years agoChange the install prefix for Haiku
Joseph R. Prostko [Sun, 29 Jun 2014 14:15:10 +0000 (15:15 +0100)]
Change the install prefix for Haiku

* /boot/common was removed from Haiku
* The equivalent path now that package management has been implemented is /boot/system/non-packaged

No functional change

Bench: 8759681

9 years agoPack 3 TT entries in 32 bytes cluster
Ron Britvich [Sat, 28 Jun 2014 18:05:58 +0000 (14:05 -0400)]
Pack 3 TT entries in 32 bytes cluster

Idea from Ron Britvich

Code reworked by Marco Costalba and Joona Kiiski

Bench: 8095369

Resolves #3
Resolves #10

9 years agoMerge pull request #9 from glinscott/pawnspan
Gary Linscott [Thu, 26 Jun 2014 19:21:06 +0000 (12:21 -0700)]
Merge pull request #9 from glinscott/pawnspan

Scale down endgames with pawns on one or two adjacent files

Passed STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 16081 W: 2745 L: 2604 D: 10732

Passed LTC
LLR: 2.95 (-2.94,2.94) [1.00,6.00]
Total: 123832 W: 17292 L: 16584 D: 89956

128k games to measure ELO at 15+0.05:
ELO: 2.07 +-1.1 (95%) LOS: 100.0%
Total: 128000 W: 21632 L: 20869 D: 85499

New bench: 8028792

9 years agoA bit more cleanup
Gary Linscott [Thu, 26 Jun 2014 19:20:30 +0000 (15:20 -0400)]
A bit more cleanup

9 years agoMerge pull request #8 from glinscott/revert_ce1c260
Gary Linscott [Thu, 26 Jun 2014 15:20:45 +0000 (08:20 -0700)]
Merge pull request #8 from glinscott/revert_ce1c260

Revert "Check for an available slave early on"

9 years agoRevert "Check for an available slave early on"
Gary Linscott [Thu, 26 Jun 2014 15:16:36 +0000 (11:16 -0400)]
Revert "Check for an available slave early on"

This reverts commit ce1c260ea97c14eea996d0a2638f4876ccbc412b.

9 years agoOriginal version of shane's patch
Gary Linscott [Wed, 25 Jun 2014 20:45:14 +0000 (16:45 -0400)]
Original version of shane's patch

9 years agoScale down endgames with pawns on one or two adjacent files
shane31 [Wed, 25 Jun 2014 20:01:00 +0000 (16:01 -0400)]
Scale down endgames with pawns on one or two adjacent files

9 years agoMerge pull request #5 from glinscott/authors
Gary Linscott [Mon, 23 Jun 2014 16:14:03 +0000 (09:14 -0700)]
Merge pull request #5 from glinscott/authors

Add AUTHORS