]> git.sesse.net Git - stockfish/log
stockfish
10 years agoFix a bogus assert in allows()
Marco Costalba [Fri, 30 Aug 2013 14:40:11 +0000 (16:40 +0200)]
Fix a bogus assert in allows()

Becuase castle is coded as "king captures the rook"
the to_sq(move), A1/8 or H1/8 is empty after the move,
leading to assert assert(p != NO_PIECE) in color_of().

Teach allows() asserts about castle and fix the crash.

Bug reported by Ryan Takker and tracked down by Tom Vijlbrief.

No functional change.

10 years agoUse frontmost_sq() and backmost_sq helpers
Marco Costalba [Fri, 30 Aug 2013 05:05:25 +0000 (07:05 +0200)]
Use frontmost_sq() and backmost_sq helpers

Should easier to read than the lsb() / msb() low
level functions.

No functional change.

10 years agoEnable LMR for dangerous moves
Gary Linscott [Thu, 29 Aug 2013 05:00:56 +0000 (01:00 -0400)]
Enable LMR for dangerous moves

Passed both short TC
LLR: 2.96 (-2.94,2.94)
Total: 5598 W: 1250 L: 1125 D: 3223

And long TC
LLR: 2.97 (-2.94,2.94)
Total: 16441 W: 3102 L: 2912 D: 10427

bench: 4620975

10 years agoBonus for rook behind a passed
homoSapiensSapiens [Thu, 22 Aug 2013 14:19:58 +0000 (17:19 +0300)]
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

10 years agoReplace hardcoded 128 by constant
homoSapiensSapiens [Thu, 29 Aug 2013 07:23:08 +0000 (10:23 +0300)]
Replace hardcoded 128 by constant

No functional change.

10 years agoAdd lsb() overload
Gary Linscott [Wed, 28 Aug 2013 07:35:04 +0000 (09:35 +0200)]
Add lsb() overload

Helper to find least significant bit relative to
the given color.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoTime management: move faster if PV is stable
Uri Blass [Sat, 24 Aug 2013 16:29:44 +0000 (19:29 +0300)]
Time management: move faster if PV is stable

Move faster but compensate by allocating more
time when the best move changes.

Passed short TC at 15+0.05
LLR: 2.93 (-2.94,2.94)
Total: 13895 W: 3030 L: 2882 D: 798

Long TC at 60+0.05
LLR: 2.96 (-2.94,2.94)
Total: 9266 W: 1777 L: 1624 D: 5865

At time increment 30+0.5
LLR: 2.96 (-2.94,2.94)
Total: 6703 W: 1238 L: 1134 D: 4331

And at fixed game number, longer TC 120+0.05
ELO: 5.17 +-2.8 (95%) LOS: 100.0%
Total: 19306 W: 3378 L: 3091 D: 12837

bench: 4728533

10 years agoSimplify chain detection
homoSapiensSapiens [Sun, 25 Aug 2013 14:59:47 +0000 (17:59 +0300)]
Simplify chain detection

No functional change.

10 years agoSimplify kf definition in shelter_storm()
homoSapiensSapiens [Sun, 25 Aug 2013 14:45:35 +0000 (17:45 +0300)]
Simplify kf definition in shelter_storm()

No functional change.

10 years agoFix KBPK bug
Chris Caino [Sat, 24 Aug 2013 08:05:48 +0000 (10:05 +0200)]
Fix KBPK bug

With

position fen 7k/8/8/8/8/7P/6K1/7B w - - 0 1
go depth 25

The evaluation at depth 22 is not draw as it should be. The reason is that
when search reaches the position 8/6kP/8/8/8/3B4/6K1/8 w - - 0 1 if white plays
h8R or h8N then we get a position that is a "KNOWN_WIN" and is _not_ a check, so
futility pruning in qsearch kicks in and black may think that it is "futile"
to reply Kxh8 since, according to the logic of the code, it cannot raise the score
back towards a draw.

bench: 4728533

10 years agoSimplify condition for backward pawn
homoSapiensSapiens [Thu, 22 Aug 2013 12:34:13 +0000 (15:34 +0300)]
Simplify condition for backward pawn

No functional changes.

10 years agoRetire redundant endgames
Marco Costalba [Thu, 22 Aug 2013 11:02:20 +0000 (13:02 +0200)]
Retire redundant endgames

The case of two lone kings on the board is already considered
by the "No pawns" scaling factor rules in material.cpp as is
KBK and KNK.

Moreover we had a small leak in endgames map because for
KK endgame it happens white and black material keys are the
same (both equal to zero), so when adding the black endgame in
Endgames::add() we were overwriting the already exsisting
white one, leading to a memory leak found by Valgrind.

So remove the endgames althogheter and rely on scaling
to correctly set the endgames value to a draw.

No functional change.

10 years agoUse null move when depth >= 2 plies
Joona Kiiski [Tue, 20 Aug 2013 22:26:16 +0000 (23:26 +0100)]
Use null move when depth >= 2 plies

Passed both short TC:
LLR: 2.96 (-2.94,2.94)
Total: 23725 W: 5031 L: 4855 D: 13839

And long TC:
LLR: 2.96 (-2.94,2.94)
Total: 15730 W: 2939 L: 2754 D: 10037

bench: 4729333

10 years agoRestore development version
Marco Costalba [Wed, 21 Aug 2013 06:40:49 +0000 (08:40 +0200)]
Restore development version

No functional change.

10 years agoStockfish 4
Marco Costalba [Tue, 20 Aug 2013 07:01:25 +0000 (09:01 +0200)]
Stockfish 4

Stockfish bench signature is: 4132374

10 years agoFix crash when reaching max ply
Tom Vijlbrief [Mon, 19 Aug 2013 14:53:06 +0000 (16:53 +0200)]
Fix crash when reaching max ply

Bug introduced in 1b7223a53c419212efbd that
updated the ss base stack without increasing
the dimension.

No functional change.

10 years agoRemove useless condition in KXK endgame
Tom Vijlbrief [Mon, 19 Aug 2013 06:54:10 +0000 (08:54 +0200)]
Remove useless condition in KXK endgame

Because eval is never called when in check.

No functional change.

10 years agoFurther tweak movecount pruning
Leonid Pechenik [Sun, 18 Aug 2013 07:11:44 +0000 (09:11 +0200)]
Further tweak movecount pruning

Passed both short TC
LLR: 2.95 (-2.94,2.94)
Total: 15140 W: 3125 L: 2976 D: 9039

And long TC
LLR: 2.95 (-2.94,2.94)
Total: 17118 W: 3165 L: 2974 D: 10979

bench: 4132374

10 years agoNormalize "pawn in front of minor" patch
Marco Costalba [Sat, 17 Aug 2013 09:05:55 +0000 (11:05 +0200)]
Normalize "pawn in front of minor" patch

No functional change.

10 years agoUse constants arguments where possible
homoSapiensSapiens [Fri, 16 Aug 2013 07:57:16 +0000 (09:57 +0200)]
Use constants arguments where possible

No functional changes.

10 years agoRevert using exceptions
Marco Costalba [Thu, 15 Aug 2013 07:36:26 +0000 (09:36 +0200)]
Revert using exceptions

Due to crashes. It will be reapplied once
we understand what's happening.

No functional change.

10 years agoSimplify DistanceRingsBB init
homoSapiensSapiens [Wed, 14 Aug 2013 08:17:22 +0000 (11:17 +0300)]
Simplify DistanceRingsBB init

Verified by same benchmark and picking some random values.

No functional change.

10 years agoSome renaming in TT store()
homoSapiensSapiens [Wed, 14 Aug 2013 05:33:33 +0000 (08:33 +0300)]
Some renaming in TT store()

No functional change.

10 years agoUse exceptions to stop the search
Marco Costalba [Wed, 14 Aug 2013 06:29:57 +0000 (08:29 +0200)]
Use exceptions to stop the search

Instead of classical flags, throw an
exception when we want to immediately halt
the search. Currently only one type
is used for both UCI stop and threads
cut off.

No functional change.

10 years agoBonus for a pawn in front of knight/bishop
Tom Vijlbrief [Tue, 13 Aug 2013 12:19:42 +0000 (14:19 +0200)]
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

10 years agoRemove Now Unneeded Help Text
Ryan Takker [Tue, 13 Aug 2013 05:36:01 +0000 (07:36 +0200)]
Remove Now Unneeded Help Text

With the new automatic setting of split depth
instead of a default, the user no longer needs
guidance on setting the split point.

Also threads now defaults to one.

No functional change.

10 years agoDon't set Search::RootColor in Eval::trace
Marco Costalba [Sun, 11 Aug 2013 05:02:50 +0000 (07:02 +0200)]
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.

10 years agoFix GrainSize rounding error
Marco Costalba [Sat, 10 Aug 2013 15:11:13 +0000 (17:11 +0200)]
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

10 years agoFix 'improving' condition
Marco Costalba [Fri, 9 Aug 2013 06:21:55 +0000 (08:21 +0200)]
Fix 'improving' condition

Because VALUE_NONE is 30002, it happens that
after a check the next move is never an improving
one.

After this patch bench signature is independent from
VALUE_NONE actual value.

bench: 4303194

10 years agoIncrease LMR when not improving
Marco Costalba [Thu, 8 Aug 2013 08:28:48 +0000 (10:28 +0200)]
Increase LMR when not improving

Apply to LMR the same Eelco's idea
applied to move count pruning.

This is the result of a series of
attempts started by Thomas Kolarik.

Passed both short TC
LLR: 2.95 (-2.94, 2.94)
Total: 5675 W: 1241 L: 1117 D: 3317

And long TC:
LLR: 2.95 (-2.94, 2.94)
Total: 8748 W: 1689 L: 1539 D: 5520

bench: 4356801

10 years agoFurther tweak Position::flip
Marco Costalba [Mon, 5 Aug 2013 11:25:21 +0000 (13:25 +0200)]
Further tweak Position::flip

No functional change.

10 years agoRewrite flip() to use FEN string manipulation
Marco Costalba [Mon, 5 Aug 2013 09:06:23 +0000 (11:06 +0200)]
Rewrite flip() to use FEN string manipulation

Instead of dealing directly with internal parameters
just "flip" the FEN string and set the position from
that.

No functional change.

10 years agoStreamline time computation
Marco Costalba [Sat, 3 Aug 2013 16:30:43 +0000 (18:30 +0200)]
Streamline time computation

No functional change.

10 years agoUpdate polyglot.ini with new "Min Split Depth" default
Marco Costalba [Sat, 3 Aug 2013 14:41:18 +0000 (16:41 +0200)]
Update polyglot.ini with new "Min Split Depth" default

No functional change.

10 years agoRefactor do_castle()
Dan Schmidt [Sat, 3 Aug 2013 12:42:58 +0000 (08:42 -0400)]
Refactor do_castle()

Not a real functional change, but bench changed due to different piecelist
reordering. To verify it a temporary my canonicalize_rooks function was
written as follows. It just ensures that the rook on the "smaller" square
is listed first.

void Position::canonicalize_rooks(Color c)
{
   if (pieceCount[c][ROOK] == 2)
   {
      Square s0 = pieceList[c][ROOK][0];
      Square s1 = pieceList[c][ROOK][1];
      if (s0 > s1)
      {
         pieceList[c][ROOK][0] = s1;
         pieceList[c][ROOK][1] = s0;
         index[s0] = 1;
         index[s1] = 0;
      }
   }
}

With this both bench and the test on Chess960 positions

./stockfish bench 128 1 8 Chess960.epd file > /dev/null

Gives same result.

bench: 4424151

10 years agoRetire cpu_count()
Joona Kiiski [Thu, 1 Aug 2013 21:12:58 +0000 (22:12 +0100)]
Retire cpu_count()

Set threads number always to 1 at startup and let the
user explicitly to chose the number of threads.

Also preserve the useful behavior of automatically set
"Min Split Depth" according to the requested threads,
indeed this parameter is too technical for a casual user,
so, when left to zero, we set it on a sensible value.

No functional change

10 years agoFurther factor out position update code
Marco Costalba [Thu, 1 Aug 2013 13:58:38 +0000 (15:58 +0200)]
Further factor out position update code

Along the lines of previous patch.

No functional change

10 years agoFactor out pieceList updating code
Dan Schmidt [Mon, 29 Jul 2013 15:44:58 +0000 (11:44 -0400)]
Factor out pieceList updating code

The new Position methods add_piece, move_piece, and remove_piece
now manage the member variables pieceList, pieceCount, and index,
and 9 blocks of code in Position that used to manipulate those
data structures by hand now call the new methods.

There is a slightly slowdown (< 1%) on Clang and on perft,
but the cleanup compensates the little speed loss.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoRework Thread hierarchy
Marco Costalba [Wed, 31 Jul 2013 07:33:26 +0000 (09:33 +0200)]
Rework Thread hierarchy

Introduce ThreadBase struct that is search
agnostic and just handles low level stuff,
and derive all the other specialized classes
form here.

In particular TimerThread does not hinerits
anymore all the search related stuff from Thread.

Also some renaming while there.

Suggested by Steven Edwards

No functional change.

10 years agoFix a race at thread creation
Marco Costalba [Wed, 31 Jul 2013 04:59:24 +0000 (06:59 +0200)]
Fix a race at thread creation

At thread creation start_routine() is called
and from there the virtual function idle_loop()
because we do this inside Thread c'tor, where the
virtual mechanism is disabled, it could happen that
the base class idle_loop() is called instead.

The issue happens with TimerThread and MainThread
where, at launch, start_routine calls
Thread::idle_loop instead of the derived ones.

Normally this bug is hidden because c'tor finishes
before start_routine() is actually called in the
just created execution thread, but on some platforms
and in some cases this is not guaranteed and the
engine hangs.

Reported by Ted Wong on talkchess

No functional change.

10 years agoTidy up Position::pretty
Marco Costalba [Mon, 29 Jul 2013 17:33:30 +0000 (19:33 +0200)]
Tidy up Position::pretty

No functional change.

10 years agoSmall renaming
Marco Costalba [Mon, 29 Jul 2013 17:32:59 +0000 (19:32 +0200)]
Small renaming

No functional change.

10 years agoSpeed up move generation
Marco Costalba [Mon, 29 Jul 2013 17:01:50 +0000 (19:01 +0200)]
Speed up move generation

Pass the color as template parameter
to generate_all()

Speedup of 1,3% in perft and 2,5% in bench !

No functional change.

10 years agoIncrease pruning if evaluation is not improving
Eelco de Groot [Sun, 28 Jul 2013 23:16:25 +0000 (01:16 +0200)]
Increase pruning if evaluation is not improving

Add an additional set of margins to movecount pruning
to be used when static evaluation is getting worse
than previous move.

Here are the margins table with changing
depth (fm0 not improving, fm1 improving):

    d: 0, fm0: 3, fm1: 3
    d: 1, fm0: 4, fm1: 4
    d: 2, fm0: 6, fm1: 6
    d: 3, fm0: 7, fm1: 10
    d: 4, fm0: 11, fm1: 15
    d: 5, fm0: 15, fm1: 21
    d: 6, fm0: 21, fm1: 29
    d: 7, fm0: 27, fm1: 37
    d: 8, fm0: 35, fm1: 47
    d: 9, fm0: 42, fm1: 57
    d: 10, fm0: 51, fm1: 68
    d: 11, fm0: 60, fm1: 81
    d: 12, fm0: 70, fm1: 94
    d: 13, fm0: 81, fm1: 108
    d: 14, fm0: 92, fm1: 123
    d: 15, fm0: 104, fm1: 139

Good at both short TC

LLR: 2.97 (-2.94,2.94)
Total: 11502 W: 2503 L: 2361 D: 6638

And long TC

LLR: 2.98 (-2.94,2.94)
Total: 7189 W: 1421 L: 1277 D: 4491

bench: 4364793

10 years agoAnnotate an unlikely condition
Marco Costalba [Sat, 27 Jul 2013 09:34:15 +0000 (11:34 +0200)]
Annotate an unlikely condition

No functional change.

10 years agoFix an assert in KBK endgame
Marco Costalba [Sat, 27 Jul 2013 06:22:12 +0000 (08:22 +0200)]
Fix an assert in KBK endgame

The endgame king + minor vs king is erroneusly
detected as king + minor vs king + minor

Here the fix is to detect king + minor earlier,
in particular to add these trivial cases to
endgame evaluation functions.

Spotted by Reuven Peleg

bench: 4727133

10 years agoRewrite pawn shield and storm code
Tom Vijlbrief [Thu, 25 Jul 2013 20:23:15 +0000 (22:23 +0200)]
Rewrite pawn shield and storm code

Passes quickly both short TC:
LLR: 2.95 (-2.94,2.94)
Total: 5755 W: 1349 L: 1222 D: 3184

And long TC:
LLR: 2.95 (-2.94,2.94)
Total: 2744 W: 628 L: 505 D: 1611

bench: 4727133

10 years agoFix a typo in bitboard.h
Marco Costalba [Thu, 25 Jul 2013 05:44:27 +0000 (07:44 +0200)]
Fix a typo in bitboard.h

Introduced by previous patch.

Spotted by Joerg Oster

No functional change.

10 years agoUse #ifndef instead of #if !defined
homoSapiensSapiens [Tue, 23 Jul 2013 13:31:57 +0000 (16:31 +0300)]
Use #ifndef instead of #if !defined

And #ifdef instead of #if defined

This is more standard form (see for example iostream file).

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoSimplify captures ordering
Marco Costalba [Sat, 20 Jul 2013 23:45:47 +0000 (01:45 +0200)]
Simplify captures ordering

A big simplification and removing of useless code.

Finished at 50% both at short TC (with SPRT) than
at long TC at fixed number of games:
ELO: -0.14 +-3.4 (95%) LOS: 46.8%
Total: 15206 W: 2836 L: 2842 D: 9528

bench: 5059948

10 years agoRevert "Halve king eval margin"
Marco Costalba [Wed, 24 Jul 2013 05:43:40 +0000 (07:43 +0200)]
Revert "Halve king eval margin"

This reverts commit 4b3a0fdab03a7529ede42891963d3036712a0bd5.

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

10 years agoTune pawn PSQT values
Ryan Schmitt [Fri, 19 Jul 2013 17:15:42 +0000 (10:15 -0700)]
Tune pawn PSQT values

Reduces the influence of PSQT for entries such as
the extended center and the h-file.

Passed both short TC test:
LLR: 2.95 (-2.94,2.94)
Total: 23919 W: 5207 L: 5029 D: 13683

And long TC one:
LLR: 2.96 (-2.94,2.94)
Total: 5762 W: 1108 L: 974 D: 3680

Bench: 4617880

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoUse arrow operator instead of * and .
Reuven Peleg [Mon, 22 Jul 2013 18:05:03 +0000 (21:05 +0300)]
Use arrow operator instead of * and .

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoBetter condition in is_pseudo_legal()
Reuven Peleg [Mon, 22 Jul 2013 10:47:59 +0000 (13:47 +0300)]
Better condition in is_pseudo_legal()

Simplify occupied destination condition.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoSmall touches in move generation
Marco Costalba [Sun, 21 Jul 2013 09:01:24 +0000 (11:01 +0200)]
Small touches in move generation

No functional change.

10 years agoSome renaming in MovePicker
Marco Costalba [Sun, 21 Jul 2013 07:54:56 +0000 (09:54 +0200)]
Some renaming in MovePicker

No functional change.

10 years agoRewrite and simplify SEE
Marco Costalba [Sat, 20 Jul 2013 17:11:03 +0000 (19:11 +0200)]
Rewrite and simplify SEE

This very speed critical code was full of clever (!)
tricks and subtle details.

So I have rewritten it in a more straithforward way
and, as very often happens, result is even faster
than original.

No functional change.

10 years agoRevert "Fix critical SEE bug (take 2)"
Marco Costalba [Sat, 20 Jul 2013 13:26:52 +0000 (15:26 +0200)]
Revert "Fix critical SEE bug (take 2)"

This reverts commit 3e95800814d

For some reason it fails the short TC test:
LLR: -2.96 (-2.94,2.94)
Total: 20033 W: 4214 L: 4265 D: 11554

bench: 4769737

10 years agoRevert "Yet another attempt at signature-build"
Marco Costalba [Sat, 20 Jul 2013 13:15:03 +0000 (15:15 +0200)]
Revert "Yet another attempt at signature-build"

Still broken on OS X

No functional change.

10 years agoFix critical SEE bug (take 2)
Marco Costalba [Sat, 20 Jul 2013 12:24:23 +0000 (14:24 +0200)]
Fix critical SEE bug (take 2)

It is somewhat unbilievable but our SEE is broken !

    If the first SEE move is a king capture and square is
    defended then SEE continues instead of breaking.

    The bug shows only on normal SEE, not see_sign() so
    probing with a:

    dbg_hit_on_c(slIndex==1, captured == KING);

    reports just a tiny:

    Total 3465656 Hits 6646 hit rate (%) 0

    Bug was there since Retire seeValues[] and move PieceValue[] out of Position of 26/6/2011 (!)
    although for some reason didn't show immediately, indeed the
    bougous patch was a "No functional change" (!!)

    bench: 4699504

10 years agoRevert all the SEE stuff
Marco Costalba [Sat, 20 Jul 2013 12:20:17 +0000 (14:20 +0200)]
Revert all the SEE stuff

The speed up seems to introduce some
functionality change.

Revert to original master for now.

bench: 4769737

10 years agoYet another attempt at signature-build
Marco Costalba [Sat, 20 Jul 2013 12:05:04 +0000 (14:05 +0200)]
Yet another attempt at signature-build

This one should work on all flavours of sed

Suggested by by Louis Zulli

No functional change.

10 years agoFix critical SEE bug
Marco Costalba [Sat, 20 Jul 2013 11:03:45 +0000 (13:03 +0200)]
Fix critical SEE bug

It is somewhat unbilievable but our SEE is broken !

If the first SEE move is a king capture and square is
defended then SEE continues instead of breaking.

The bug shows only on normal SEE, not see_sign() so
probing with a:

dbg_hit_on_c(slIndex==1, captured == KING);

reports just a tiny:

Total 3465656 Hits 6646 hit rate (%) 0

Bug was there since 351ef5c85b6d4b9c71e9da of 26/6/2011 (!)
although for some reason didn't show immediately, indeed the
bougous patch was a "No functional change" (!!)

bench: 4793754

10 years agoSpeedup see()
Marco Costalba [Sat, 20 Jul 2013 09:44:55 +0000 (11:44 +0200)]
Speedup see()

And rename next_attacker() SEE helper

This very simple patch is able to speed up
bench run of almost 2% !

No functional change.

10 years agoFix signature-build under OSX
Marco Costalba [Fri, 19 Jul 2013 15:20:26 +0000 (17:20 +0200)]
Fix signature-build under OSX

On OS X when you use -i an extension for the in-place
substitution a backup files is required.

http://stackoverflow.com/questions/4247068/sed-command-failing-on-mac-but-works-on-linux

So rewrite to make sed flushing sign.txt in one go and avoid
using -i option.

Reported by Louis Zulli

No functional change.

10 years agoMicroptimize gives_check() for castling case
Reuven Peleg [Fri, 19 Jul 2013 15:01:07 +0000 (17:01 +0200)]
Microptimize gives_check() for castling case

Without patch we have 333198 nps, with patch 334249.

A very small +0.3%, not a lot manily becuase this is a
side path that is taken very few times.

Anyhow idea is correct becuase first 'quick' condition
has an hit rate of about 95%.

No functional change.

10 years agoSmall simplification in space eval scoring
Marco Costalba [Fri, 19 Jul 2013 09:00:31 +0000 (11:00 +0200)]
Small simplification in space eval scoring

No functional change.

10 years agoRename MoveStack to ExtMove
Marco Costalba [Fri, 19 Jul 2013 08:27:15 +0000 (10:27 +0200)]
Rename MoveStack to ExtMove

Stack has no meaning here, while ExtMove (extended move),
better clarifies that we have a move + a score.

No functional change.

10 years agoBetter document what we skip when in check
Marco Costalba [Fri, 19 Jul 2013 07:37:31 +0000 (09:37 +0200)]
Better document what we skip when in check

No functional change.

10 years agoHalve king eval margin
homoSapiensSapiens [Tue, 16 Jul 2013 15:52:55 +0000 (18:52 +0300)]
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>
10 years agoDrop grep and tr dependency in Makefile
Marco Costalba [Mon, 15 Jul 2013 19:39:06 +0000 (21:39 +0200)]
Drop grep and tr dependency in Makefile

Use only sed to get the bench signature.

No functional change.

10 years agoDon't use __builtin_expect
Marco Costalba [Mon, 15 Jul 2013 19:09:06 +0000 (21:09 +0200)]
Don't use __builtin_expect

Partially revert previous patch and use
unlikey() just as code annotation.

Actually it is better to rely on a profiler for branch prediction:

http://blog.man7.org/2012/10/how-much-do-builtinexpect-likely-and.html

"In fact, even when only one in ten thousand values is nonzero,
we're still at only roughly the break-even point"

No functional change,

10 years agoBetter annotate unlikely conditions
Marco Costalba [Mon, 15 Jul 2013 18:50:24 +0000 (20:50 +0200)]
Better annotate unlikely conditions

And in case of gcc we win also a small
speed optimization due to better branch
prediction.

No functional change.

10 years agoSimplify a condition in refutes()
Reuven Peleg [Mon, 15 Jul 2013 13:14:30 +0000 (16:14 +0300)]
Simplify a condition in refutes()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoUpdate 'make help'
Marco Costalba [Sun, 14 Jul 2013 10:23:28 +0000 (12:23 +0200)]
Update 'make help'

No functional change.

10 years agoAdd signature-profile-build make target
Marco Costalba [Sun, 14 Jul 2013 09:57:06 +0000 (11:57 +0200)]
Add signature-profile-build make target

Extend patch 3f64a2af6a7dac4 to profile builds.

here the make command is:

make signature-profile-build ARCH=xxx COMP=xxx

No functional change.

10 years agoRetire engine Tag
Marco Costalba [Sun, 14 Jul 2013 09:07:24 +0000 (11:07 +0200)]
Retire engine Tag

It is somewhat redundant and could make SF
name too long, so use just Version, in case
of a signature build Version will be set to
'sig-xxx' otherwise, if left empty, we fall
back on usual date stamp.

No functional change.

10 years agoAdd signature-build make target
Marco Costalba [Sun, 14 Jul 2013 07:00:19 +0000 (09:00 +0200)]
Add signature-build make target

When compiling with:

make signature-build ARCH=xxx COMP=xxx

After binary has been roduced, it will be run to
get the signature 'stockfish bench' and this
number will be used as Version, so that it
will be easy to track the original sources
from a binary.

No functinal change.

10 years agoFix build on Intel compiler
Marco Costalba [Sat, 13 Jul 2013 21:07:24 +0000 (23:07 +0200)]
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 bcbc9bfd1f5efeaa3

No functional change.

10 years agoFully qualify memset and memcpy
Marco Costalba [Sat, 13 Jul 2013 15:21:24 +0000 (17:21 +0200)]
Fully qualify memset and memcpy

And other trivial touches.

Ispired by Lucas's DiscoCheck

No functional change.

10 years agoRetire enoughMaterial + lower trapped rook threshold
Tom Vijlbrief [Sat, 13 Jul 2013 09:46:59 +0000 (11:46 +0200)]
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

10 years agoA useless assignment found by Clang’s static analyzer
Marco Costalba [Sat, 13 Jul 2013 11:27:22 +0000 (13:27 +0200)]
A useless assignment found by Clang’s static analyzer

Warning is: "Value stored to 'xxx' is never read" and
it is raised in SpNode case.

No functional change.

10 years agoFix build with MSVC 2013
Marco Costalba [Sat, 13 Jul 2013 11:02:40 +0000 (13:02 +0200)]
Fix build with MSVC 2013

Also add an assert hinted by MSVC code analysis tool.

No functional change.

10 years agoFix printing of PV info: take 2
Marco Costalba [Sat, 13 Jul 2013 05:43:50 +0000 (07:43 +0200)]
Fix printing of PV info: take 2

Now last PV line is printed twice, fix that.

No functional change.

10 years agoFix printing of PV info
Marco Costalba [Fri, 12 Jul 2013 21:42:42 +0000 (23:42 +0200)]
Fix printing of PV info

It was erroneusly skipped after the
aspiration window rework.

Reported by Eelco.

No functional change.

10 years agoRename some UCI options
Marco Costalba [Thu, 11 Jul 2013 14:01:33 +0000 (16:01 +0200)]
Rename some UCI options

Thanks to Don, Miguel, Louis and the other people
of talkchess forum for the suggestion:

http://www.talkchess.com/forum/viewtopic.php?t=48612

Also sync polyglot.ini with current UCI options

No functional change.

10 years agoFix a crash with depth 1 perft
Marco Costalba [Thu, 11 Jul 2013 05:22:26 +0000 (07:22 +0200)]
Fix a crash with depth 1 perft

Bug recently introduced in e215a88cddd16e09

No functional change.

10 years agoDon't IID when in check also in PvNodes
Marco Costalba [Sun, 7 Jul 2013 11:45:46 +0000 (13:45 +0200)]
Don't IID when in check also in PvNodes

This tiny functional change allows to
nicely simplify things.

Performed at 50% in short TC:
LLR: -0.43 (-2.94,2.94)
Total: 46406 W: 9681 L: 9565 D: 27160

And succesfully passed long TC reverse test:
LLR: -2.95 (-2.94,2.94)
Total: 4945 W: 858 L: 937 D: 3150

bench: 4507230

10 years agoRevert previous patch
Marco Costalba [Tue, 9 Jul 2013 06:01:51 +0000 (08:01 +0200)]
Revert previous patch

Unfortunatly a reverse test at long TC failed:

master^ vs master
LLR: 1.37 (-2.94,2.94)
Total: 33682 W: 6294 L: 6071 D: 21317

So becuase short TC score is 50% there is a good
possibility patch is not scalable.

So revert it.

bench: 4507288

10 years agoSimplify "fail high upon reduction" in null search
Marco Costalba [Mon, 8 Jul 2013 05:23:30 +0000 (07:23 +0200)]
Simplify "fail high upon reduction" in null search

Do not use threat move to detect the condition. This
let us to retire the big allows() function.

Test at short TC was within 50% score:
LLR: -2.95 (-2.94,2.94)
Total: 38272 W: 7941 L: 7940 D: 22391

To be verified with reverse long TC

bench: 4191565

10 years agoSkip node-level cut-off tests when in check
Marco Costalba [Sun, 7 Jul 2013 11:27:31 +0000 (13:27 +0200)]
Skip node-level cut-off tests when in check

No functional change.

10 years agoSimplify aspiration window code
Marco Costalba [Wed, 3 Jul 2013 16:58:49 +0000 (18:58 +0200)]
Simplify aspiration window code

Here the main difference is that now we center
aspiration window on last returned score. This allows
to simplify handling of mate scores.

We have done a reversed SPRT tests, where we wanted to
verify if master is stronger than this patch.

Long TC: master vs this patch (reverse test)
LLR: -2.95 (-2.94,2.94)
Total: 37992 W: 7012 L: 6920 D: 24060

bench: 4507288

10 years agoWorkaround github issue
Marco Costalba [Wed, 3 Jul 2013 16:58:23 +0000 (18:58 +0200)]
Workaround github issue

Temporary revert aspiration window patch
so to be visible to everybody: it will be
re-applied with next patch

No functional change (together with next one)

10 years agoSimplify aspiration window code
Marco Costalba [Wed, 3 Jul 2013 06:54:44 +0000 (08:54 +0200)]
Simplify aspiration window code

Here the main difference is that now we center
aspiration window on last returned score. This allows
to simplify handling of mate scores.

We have done a reversed SPRT tests, where we wanted to
verify if master is stronger than this patch.

Long TC: master vs this patch (reverse test)
LLR: -2.95 (-2.94,2.94)
Total: 37992 W: 7012 L: 6920 D: 24060

bench: 4507288

10 years agoDisable flto when debugging
Marco Costalba [Wed, 3 Jul 2013 06:21:21 +0000 (08:21 +0200)]
Disable flto when debugging

Link-time optimization does not work well with
generation of debugging information:

http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

Reported by Louis Zulli

No functional change.

10 years agoRevert "Remove confusing optimization"
Marco Costalba [Tue, 2 Jul 2013 18:06:24 +0000 (20:06 +0200)]
Revert "Remove confusing optimization"

This reverts commit e05c80a08859f6c4f0f599ca0b262ced00ad66fe.

we gain a speed up of 1.5% under gcc !

No functional change.

10 years agoMerge branch 'master' into aspiration
Marco Costalba [Tue, 2 Jul 2013 05:25:47 +0000 (07:25 +0200)]
Merge branch 'master' into aspiration

bench: 4507288

10 years agoRevert "Increase earlier aspiration window size"
Marco Costalba [Tue, 2 Jul 2013 05:25:39 +0000 (07:25 +0200)]
Revert "Increase earlier aspiration window size"

This reverts commit b88bc7b7667fc6ddbfc7412fb2c0bfc13e3bf11c.

10 years agoEntering a pawn endgame is no more dangerous
Marco Costalba [Tue, 2 Jul 2013 05:24:17 +0000 (07:24 +0200)]
Entering a pawn endgame is no more dangerous

A simplification of the 'dangerous' definition.

Seems neutral at reverse test at long TC

master vs patch
LLR: -2.96 (-2.94,2.94)
Total: 16974 W: 3122 L: 3139 D: 10713

bench: 4689029

10 years agoIncrease earlier aspiration window size
Marco Costalba [Mon, 1 Jul 2013 17:29:23 +0000 (19:29 +0200)]
Increase earlier aspiration window size

bench: 4377851