]> git.sesse.net Git - stockfish/log
stockfish
9 years agoDon't need floor() in timeman.cpp
Marco Costalba [Sun, 27 Apr 2014 17:10:00 +0000 (19:10 +0200)]
Don't need floor() in timeman.cpp

For positive numbers result is equivalent:
http://stackoverflow.com/questions/3300290/cast-to-int-vs-floor

Spotted by Joseph Ellis.

No functional change.

9 years agoFix Intel compiler warnings
Marco Costalba [Sun, 27 Apr 2014 10:02:36 +0000 (12:02 +0200)]
Fix Intel compiler warnings

Fallout from previous patch: Intel compiler
is very noisy.

No functional change.

9 years agoRemove some useless casts
Marco Costalba [Sun, 27 Apr 2014 09:40:44 +0000 (11:40 +0200)]
Remove some useless casts

No functional change.

9 years agoWe can add an integer to a Value
Marco Costalba [Sun, 27 Apr 2014 08:13:59 +0000 (10:13 +0200)]
We can add an integer to a Value

We have defined corresponding operators,
so rely on them to streamline the code
and increase readibility.

No functional change.

9 years agoRemove rook passers eval completely
Arjun Temurnikar [Sun, 20 Apr 2014 23:44:18 +0000 (16:44 -0700)]
Remove rook passers eval completely

Tested in no-regression mode.

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

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

bench: 7396783

9 years agoReformatting in material.h
Marco Costalba [Sun, 27 Apr 2014 07:31:22 +0000 (09:31 +0200)]
Reformatting in material.h

No functional change.

9 years agoMove game phase constants to enum Value
Marco Costalba [Sun, 27 Apr 2014 07:23:45 +0000 (09:23 +0200)]
Move game phase constants to enum Value

No functional change.

9 years agoSpeed up by almost 3%
Marco Costalba [Sat, 26 Apr 2014 22:25:18 +0000 (00:25 +0200)]
Speed up by almost 3%

This apparentely silly tweak allows
to speed up the bench by almost 3%.

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

Suggested by Jonathan Calovski.

No functional change.

9 years agoFix issues detected by Coverity Scan
Marco Costalba [Sat, 26 Apr 2014 07:20:37 +0000 (09:20 +0200)]
Fix issues detected by Coverity Scan

Most of Coverity Scan reports are false
positives, but in rare cases we have
confirmed (very small) issues.

No functional change.

9 years agoSpeed up picking of killers
Marco Costalba [Fri, 25 Apr 2014 10:53:51 +0000 (12:53 +0200)]
Speed up picking of killers

Changing the order of the conditions gives
about 1% speed up!

No functional change.

9 years agoRemove RookOn7th and merge values into psqt
Arjun Temurnikar [Sun, 20 Apr 2014 10:50:03 +0000 (03:50 -0700)]
Remove RookOn7th and merge values into psqt

Tested in no-regression mode:

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

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

bench: 7905850

9 years agoRemove penalty for knight when few enemy pawns
Arjun Temurnikar [Sat, 19 Apr 2014 01:54:23 +0000 (18:54 -0700)]
Remove penalty for knight when few enemy pawns

Tested in standard mode at STC and no-regression
mode at LTC:

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

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

bench: 8331217

9 years agoShuffle movepicker score
Jonathan Calovski [Wed, 23 Apr 2014 03:14:46 +0000 (13:14 +1000)]
Shuffle movepicker score

Believed to be a speed optimization as benched
on Windows with bench realtime affinity 0x1 deleting
highest and lowest runs:

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

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

No functional change.

9 years agoCorrectly apply previous patch
Marco Costalba [Thu, 24 Apr 2014 06:35:13 +0000 (08:35 +0200)]
Correctly apply previous patch

Apply the correct values from previous patch.

bench: 8082049

9 years agoMove queen vs. 3 minors rule to imbalance tables
joergoster [Sat, 19 Apr 2014 14:41:56 +0000 (16:41 +0200)]
Move queen vs. 3 minors rule to imbalance tables

Tuned with CLOP after 57k games.

Simplification: tested in no-regression mode.

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

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

bench: 8082049

9 years agoRevert "Generalize shift_bb() to handle double pushes"
Marco Costalba [Mon, 21 Apr 2014 18:54:55 +0000 (20:54 +0200)]
Revert "Generalize shift_bb() to handle double pushes"

Seems to intorduce some compiler warning as
reported by Gary. Warning seems bogus, but
revert anyhow.

No functional change.

9 years agoReset DrawValue[] before new search
Marco Costalba [Mon, 21 Apr 2014 12:30:27 +0000 (14:30 +0200)]
Reset DrawValue[] before new search

Spotted by Ronald de Man

bench: 7384368

9 years agoRise contempt when in advantage
Leonid Pechenik [Thu, 17 Apr 2014 16:49:57 +0000 (12:49 -0400)]
Rise contempt when in advantage

This is a very discussed patch with many
argumentations pro and against. The fact is
it passed both STC:

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

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

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

bench: 7384368

9 years agoStreamline implementation of Position::pretty()
Marco Costalba [Mon, 21 Apr 2014 09:42:08 +0000 (11:42 +0200)]
Streamline implementation of Position::pretty()

Simpler and more in line with Bitboards::pretty()

No functional change.

9 years agoRaise penalty blocked enemy pawn on 6th rank
Stefan Geschwentner [Sat, 5 Apr 2014 10:27:57 +0000 (12:27 +0200)]
Raise penalty blocked enemy pawn on 6th rank

Idea from Lyudmil Tsvetkov.

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

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

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

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

bench: 7154916

9 years agoGeneralize shift_bb() to handle double pushes
Marco Costalba [Sun, 20 Apr 2014 13:15:43 +0000 (15:15 +0200)]
Generalize shift_bb() to handle double pushes

And use it in evaluate_space.

No functional change.

9 years agoSmall simplification to passed pawns
Arjun Temurnikar [Fri, 18 Apr 2014 04:41:22 +0000 (21:41 -0700)]
Small simplification to passed pawns

Tested in no-regression mode.

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

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

bench: 8165681

10 years agoRemove supporting pawns
Joseph Hellis [Thu, 17 Apr 2014 06:43:40 +0000 (08:43 +0200)]
Remove supporting pawns

Tested in no-regression mode

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

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

Bench: 7907885

10 years agoEnable BMI1 too when using BMI2 ARCH
Jean-Francois Romang [Mon, 14 Apr 2014 05:10:39 +0000 (07:10 +0200)]
Enable BMI1 too when using BMI2 ARCH

Adding BMI1 allows the compiler to use _blsr_u64
automatically (the advertised 0.3% speed gain).
I verified that the compiler does not use this
instruction with the -mbmi2 flag only. Also, all
processors supporting BMI2 is also supporting BMI1.

No functional change

10 years agoMore readable trapped rook condition
Marco Costalba [Sun, 13 Apr 2014 11:35:58 +0000 (13:35 +0200)]
More readable trapped rook condition

Prefer

file_of(s) < file_of(ksq)

to the inidrect

file_of(ksq) < FILE_E

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

Also other small touches while there.

No functional change.

10 years agoSimplify Makefile by removing OS X targets
Daylen Yang [Sat, 12 Apr 2014 23:26:45 +0000 (16:26 -0700)]
Simplify Makefile by removing OS X targets

Right now the Makefile is cluttered with OS X equivalents
of all the x86 targets. We can get rid of all of them and
just check UNAME against "Darwin" for the few OS X-specific
things we need to do.

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

No functional change.

10 years agoMove args parsing to UCI::loop
Marco Costalba [Sat, 12 Apr 2014 10:52:10 +0000 (12:52 +0200)]
Move args parsing to UCI::loop

This leaves a very clean main.cpp

No functional change.

10 years agoReshuffle in uci.cpp
Marco Costalba [Sat, 12 Apr 2014 10:05:25 +0000 (12:05 +0200)]
Reshuffle in uci.cpp

Move function definitions before call site.

No functional change.

10 years agoReshuffle in timeman.cpp
Marco Costalba [Sat, 12 Apr 2014 10:00:37 +0000 (12:00 +0200)]
Reshuffle in timeman.cpp

Move template definitions before call site.

No functional change.

10 years agoFix a typo in evaluate
Marco Costalba [Sat, 12 Apr 2014 08:17:41 +0000 (10:17 +0200)]
Fix a typo in evaluate

Spotted by Lyudmil Antonov.

No functional change.

10 years agoRetire signature-build
Marco Costalba [Sat, 12 Apr 2014 07:18:55 +0000 (09:18 +0200)]
Retire signature-build

Does not seem used.

No functional change.

10 years agoAdd ARCH x86-64-bmi2 support
Jean-Francois Romang [Thu, 10 Apr 2014 18:07:40 +0000 (20:07 +0200)]
Add ARCH x86-64-bmi2 support

Intel Haswell and newer CPUs can calculate sliders
attacks using special PEXT asm instructions instead
of magic bitboards. This gives a +3% speed up.

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

No functional change.

10 years agoSwitch to hardware PEXT
Marco Costalba [Mon, 7 Apr 2014 19:04:34 +0000 (21:04 +0200)]
Switch to hardware PEXT

Retire software pext and introduce hardware
call when USE_PEXT is defined during compilation.

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

No functional change.

10 years agoImplement PEXT based attacks
Marco Costalba [Mon, 7 Apr 2014 14:27:14 +0000 (16:27 +0200)]
Implement PEXT based attacks

According to:

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

No functional change.

10 years agoAdd PEXT software implementation
Marco Costalba [Mon, 7 Apr 2014 14:02:24 +0000 (16:02 +0200)]
Add PEXT software implementation

For development/debug purposes.

No functional change.

10 years agoBig reshuffle in evaluate.cpp
Marco Costalba [Sat, 12 Apr 2014 06:32:52 +0000 (08:32 +0200)]
Big reshuffle in evaluate.cpp

Reshuffle functions to define them in reverse
calling order (C style).

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

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

No functional change.

10 years agoMove LowMobPenalty into psq/mobility tables
Gary Linscott [Fri, 11 Apr 2014 16:14:57 +0000 (12:14 -0400)]
Move LowMobPenalty into psq/mobility tables

Tested in no-regression mode.

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

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

bench: 6921356

10 years agoReduce penalty for doubled pawns further away from each other
Gary Linscott [Fri, 11 Apr 2014 15:04:48 +0000 (11:04 -0400)]
Reduce penalty for doubled pawns further away from each other

Passed both STC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 38339 W: 6849 L: 6649 D: 24841

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

bench: 7508468

10 years agoFurther simplification in evaluate
Marco Costalba [Fri, 11 Apr 2014 06:38:09 +0000 (08:38 +0200)]
Further simplification in evaluate

No functional change

10 years agoGet rid of an evaluate_pieces() overload
Marco Costalba [Thu, 10 Apr 2014 17:45:18 +0000 (19:45 +0200)]
Get rid of an evaluate_pieces() overload

Rewrite and greatly simplify that part of code.

No functional change.

10 years agoAdd a penalty for low mobility pieces
Gary Linscott [Thu, 10 Apr 2014 06:34:14 +0000 (08:34 +0200)]
Add a penalty for low mobility pieces

Passed both STC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 81857 W: 14652 L: 14342 D: 52863

and LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 45400 W: 6999 L: 6697 D: 31704

bench: 7716978

10 years agoRestrict queen mobility to safe squares
Gary Linscott [Tue, 8 Apr 2014 19:50:01 +0000 (21:50 +0200)]
Restrict queen mobility to safe squares

Passed both STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 16188 W: 3119 L: 2971 D: 10098

and LTC
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 6336 W: 1010 L: 882 D: 4444

bench: 7533692

10 years agoRescale UCI scores to PawnValueEg
Lucas Braesch [Sun, 6 Apr 2014 09:43:30 +0000 (11:43 +0200)]
Rescale UCI scores to PawnValueEg

This is more consistent with what other engines are doing.
Often people thinks that SF's scores are overblown. In the
end, it just boils down to the arbitrary way of rescaling them.

No functional change.

10 years agoSync some common names
Marco Costalba [Sun, 6 Apr 2014 08:50:27 +0000 (10:50 +0200)]
Sync some common names

No functional change.

10 years agoSome more work in pretty_pv
Marco Costalba [Sat, 5 Apr 2014 23:11:30 +0000 (01:11 +0200)]
Some more work in pretty_pv

No functional change.

10 years agoSmall tidy up in move_to_san
Marco Costalba [Sat, 5 Apr 2014 16:54:37 +0000 (18:54 +0200)]
Small tidy up in move_to_san

No functional change.

10 years agoSmaller and faster profile-build binaries
mstembera [Sat, 5 Apr 2014 10:46:17 +0000 (12:46 +0200)]
Smaller and faster profile-build binaries

I have noticed that increasing the bench depth produces
progressively smaller and slightly faster executables at
the cost of longer compile times.  Also using bench "time"
instead of "depth" seems to produce slightly smaller/faster
executables  given comparable compile times.

I have made a new Makefile that generates smaller and
about 1% to 2% faster profile executables at only a
little extra compile time.  On  my mobile 2GHz i7 a
full profile build time goes from 3'48" to 4'13" and
the exe goes down by 5% from 416,310 bytes to 395,567
bytes.

No functional change.

10 years agoRemove QueenOn7th and QueenOnPawn
Lucas Braesch [Thu, 3 Apr 2014 13:31:42 +0000 (21:31 +0800)]
Remove QueenOn7th and QueenOnPawn

Small simplification.

Passed SPRT(-3,1) both at STC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 17051 W: 3132 L: 3005 D: 10914

and LTC:
LLR: 4.55 (-2.94,2.94) [-3.00,1.00]
Total: 24890 W: 3842 L: 3646 D: 17402

The rationale behind this is that I've never managed to add a
Queen on 7th rank bonus in DiscoCheck, because it never showed
to be positive (evne slightly) in testing. The only thing that
worked is Rook on 7th rank.

In terms of SF code, it seemed natural to group it with QueenOnPawn
as well as those are done together. I know you're against groupping
in general, but when it comes to non regression test, you are being
more conservative by groupping. If the group passes SPRT(-3,1) it's
safer to commit, than test every component in SPRT(-3,1) and end up
with the risk of commiting several -1 elo regression instead of just
one -1 elo regression.

In chess terms, perhaps it's just easier to manouver a Queen (which
can more also diagonaly) than a Rook. Therefore you can let the search
do its job without needing eval ad-hoc terms to guide it. For the Rook
which takes more moves to manouver such eval terms can be (marginally)
useful.

bench: 7473314

10 years agoSpeed up apply_weight
mstembera [Fri, 4 Apr 2014 03:08:54 +0000 (20:08 -0700)]
Speed up apply_weight

Speed up by about 2% this hot path function pre-calculating
midgame and endgame values of the weight.

No functional change.

10 years agoUpdate Readme to 128 max threads
Marco Costalba [Thu, 3 Apr 2014 09:33:42 +0000 (11:33 +0200)]
Update Readme to 128 max threads

No functional change.

10 years agoQueen vs. 3 pieces imbalance
Joerg Oster [Thu, 3 Apr 2014 08:38:11 +0000 (10:38 +0200)]
Queen vs. 3 pieces imbalance

Passed both STC
LLR: 7.32 (-2.94,2.94) [-1.50,4.50]
Total: 98108 W: 18087 L: 17576 D: 62445

And LTC
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 15082 W: 2417 L: 2248 D: 10417

bench: 7717336

10 years agoMake operator<< to return void
Marco Costalba [Thu, 3 Apr 2014 08:34:25 +0000 (10:34 +0200)]
Make operator<< to return void

This should help preventing misuse.

No functional change.

10 years agoDrop not defended by pawn condition
Stefan Geschwentner [Tue, 1 Apr 2014 09:58:10 +0000 (11:58 +0200)]
Drop not defended by pawn condition

Passed no-regression test both at STC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 96554 W: 17563 L: 17572 D: 61419

and at LTC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 31891 W: 4905 L: 4801 D: 22185

bench: 7720896

10 years agoDo not workaround function argument evaluation
Marco Costalba [Tue, 1 Apr 2014 07:39:41 +0000 (09:39 +0200)]
Do not workaround function argument evaluation

Rewrite options initialization to do not trying to
hack upon the undefined evaluation order of function
arguments.

No functional change.

10 years agoFix a compile error with Intel C++
Marco Costalba [Sun, 30 Mar 2014 12:20:12 +0000 (14:20 +0200)]
Fix a compile error with Intel C++

Error: a value of type "int" cannot be assigned
to an entity of type "Value"

No functional change.

10 years agoFix a warning with MSVC 2010
Marco Costalba [Sun, 30 Mar 2014 12:25:57 +0000 (14:25 +0200)]
Fix a warning with MSVC 2010

Warning C4804: '<' : unsafe use of type 'bool' in operation

No functional change.

10 years agoShow evaluation from white POV in trace
Marco Costalba [Sun, 30 Mar 2014 08:11:32 +0000 (10:11 +0200)]
Show evaluation from white POV in trace

We chose this instead of negamax sign convention
(ie. from the point of view of the side to move)
because it is more in line to how the eval
table is presented.

Also some tweak to formatting while there.

No functional change.

10 years agoRaise VALUE_INFINITE
Marco Costalba [Sat, 29 Mar 2014 10:12:37 +0000 (11:12 +0100)]
Raise VALUE_INFINITE

In some legal positions like this one:
R6R/3Q4/1Q4Q1/4Q3/2Q4Q/Q4Q2/Np1Q4/kB1N1KB1  b -- 0 1

We can have a very high score, in this case 30177 and 29267
for midgame and endgame respectively, and because
VALUE_INFINITE = 30001 we have an assert in interpolate()

Midgame and endgame scores are stored in 16 bit signed integers
so we can rise VALUE_INFINITE a little bit. This does not fix
the possibility of overflow in general case, just makes the
condition more difficult to trigger and anyhow better uses all
the score width.

Raising VALUE_INFINITE to 32000 seems to fix the problem for this
particular case.

No functional change.

10 years agoFurther simplification of TT replace strategy
Jean-Francois Romang [Thu, 27 Mar 2014 17:38:19 +0000 (18:38 +0100)]
Further simplification of TT replace strategy

No functional change

10 years agoRestore old aspiration window to 16
Marco Costalba [Wed, 26 Mar 2014 05:39:46 +0000 (06:39 +0100)]
Restore old aspiration window to 16

Tested directly at LTC because previous long
test series on this topic shows it is TC dependant.

Tested with no-regression mode because gets rid of
an ugly and ad-hoc rule.

Test at LTC:
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 67918 W: 10590 L: 10541 D: 46787

bench: 7926803

10 years agoPinned pieces affect king safety
Stefan Geschwentner [Fri, 28 Mar 2014 07:41:50 +0000 (08:41 +0100)]
Pinned pieces affect king safety

Here the new idea is to link pinned pieces
with king safety.

Passed both STC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 10047 W: 1867 L: 1737 D: 6443

And LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 10419 W: 1692 L: 1543 D: 7184

bench: 8325087

10 years agoFix a bug in pawns eval tracing
Marco Costalba [Wed, 26 Mar 2014 06:06:29 +0000 (07:06 +0100)]
Fix a bug in pawns eval tracing

Instead of totals we were showing white and
black values.

Spotted by Sven Schüle

No functional change.

10 years agoSimplify TT replace strategy
Marco Costalba [Sun, 23 Mar 2014 09:03:11 +0000 (10:03 +0100)]
Simplify TT replace strategy

Tested for no-regression with SPRT[-3, 1] at STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 32046 W: 6020 L: 5918 D: 20108

No functional change.

10 years agoIntroduce penalty for weak (=unsupported) pawns.
snicolet [Sun, 23 Mar 2014 22:51:25 +0000 (23:51 +0100)]
Introduce penalty for weak (=unsupported) pawns.

We add a penalty for each pawn which is not protected by another pawn
of the same color.

Passed both short TC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 12107 W: 2411 L: 2272 D: 7424

And long TC
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 9204 W: 1605 L: 1458 D: 6141

bench: 7682173

10 years agoFix an incorrect 'friend' declaration
Marco Costalba [Sun, 23 Mar 2014 10:17:38 +0000 (11:17 +0100)]
Fix an incorrect 'friend' declaration

Spotted by Lee David.

No functional change.

10 years agoRetire last usage of operator|(File f, Rank r)
Marco Costalba [Sun, 23 Mar 2014 09:42:37 +0000 (10:42 +0100)]
Retire last usage of operator|(File f, Rank r)

This for some reason was missed.

No functional change.

10 years agoRefresh TT entries generation automatically on probe
mstembera [Sun, 23 Mar 2014 08:24:35 +0000 (09:24 +0100)]
Refresh TT entries generation automatically on probe

And other assorted simplifications, tested with SPRT[-3, 1]

Passed both short TC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 18814 W: 3600 L: 3475 D: 11739

And long TC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 20731 W: 3217 L: 3096 D: 14418

No functional change.

10 years agoRename score to value in ExtMove
Marco Costalba [Sun, 23 Mar 2014 07:52:42 +0000 (08:52 +0100)]
Rename score to value in ExtMove

We use 'score' for the value mid-endgame pair.

No functional change.

10 years agoTrivial formatting in ucioption.cpp
Marco Costalba [Sat, 22 Mar 2014 23:06:26 +0000 (00:06 +0100)]
Trivial formatting in ucioption.cpp

No functional change.

10 years agoRetire operator|(File f, Rank r)
Marco Costalba [Sat, 22 Mar 2014 22:35:30 +0000 (23:35 +0100)]
Retire operator|(File f, Rank r)

Use make_square() instead. Less fancy but
more clear.

No functional change.

10 years agoFix a subtle bug in UCI options printing
Marco Costalba [Sat, 22 Mar 2014 10:15:28 +0000 (11:15 +0100)]
Fix a subtle bug in UCI options printing

We want all the UCI options are printed in the order in which are
assigned, so we use an index that, depending on Options.size(),
increases after each option is added to the map. The problem is
that, for instance, in the first assignment:

o["Write Debug Log"] = Option(false, on_logger);

Options.size() can value 0 or 1 according if the l-value (that
increments the size) has been evaluated after or before the
r-value (that uses the size value).

The culprit is that assignment operator in C++ is not a
sequence point:

http://en.wikipedia.org/wiki/Sequence_point

(Note: to be nitpick here we actually use std::map::operator=()
 that being a function can evaluate its arguments in any order)

So there is no guarantee on what term is evaluated first and
behavior is undefined by standard in this case. The net result
is that in case r-value is evaluated after l-value the last
idx is not size() - 1, but size() and in the printing loop
we miss the last option!

Bug was there since ages but only recently has been exposed by
the removal of UCI_Analyze option so that the last one becomes
UCI_Chess960 and when it is missing engine cannot play anymore
Chess960.

The fix is trivial (although a bit hacky): just increase the
last loop index.

Reported by Eric Mullins that found it on an ARM and MIPS
platforms with gcc 4.7

No functional change.

10 years agoFix a typo
Marco Costalba [Tue, 18 Mar 2014 17:35:03 +0000 (18:35 +0100)]
Fix a typo

Spotted by Isaac Haïk Dunn.

No functional change.

10 years agoIncrease max threads to 128
Marco Costalba [Tue, 18 Mar 2014 11:07:26 +0000 (12:07 +0100)]
Increase max threads to 128

Thanks to std::bitset we can easily increase
the limit of active threads above 64.

Thanks to Lucas Braesch for pointing at the
correct solution of using std::bitset.

No functional change.

10 years agoFix a crash under MSVC
Marco Costalba [Sun, 16 Mar 2014 09:55:58 +0000 (10:55 +0100)]
Fix a crash under MSVC

Using memset on a std::vector is undefined behavior,
so manually init all the data memebers of LimitsType.

Bug intorduced in 41641e3b1eea0038ab6984

No functional change.

10 years agoSplit also if no slaves are found
Marco Costalba [Sat, 15 Mar 2014 22:43:35 +0000 (23:43 +0100)]
Split also if no slaves are found

Because we test for available slaves before
entering split(), we almost always allocate a
slave, only in the rare case of a race (less
then 2% of cases) this is not true, but to
special case this occurrence is not worth
the added complexity.

bench: 7451319

10 years agoRemove "Max Threads per Split Point" UCI option
Marco Costalba [Sat, 15 Mar 2014 20:13:43 +0000 (21:13 +0100)]
Remove "Max Threads per Split Point" UCI option

Experimental patch to verify if drop of nps
in endgames at very long TC is due to this.

Suggested by Ronald de Man.

bench: 7451319

10 years agoMerge default tests in pos_is_ok
Marco Costalba [Sat, 15 Mar 2014 14:26:29 +0000 (15:26 +0100)]
Merge default tests in pos_is_ok

No functional change.

10 years agoMicroptimize castling in undo_move()
Marco Costalba [Sat, 15 Mar 2014 10:21:47 +0000 (11:21 +0100)]
Microptimize castling in undo_move()

We don't need to set 'captured' and 'pt' after we
castle back.

No functional change.

10 years agoDepth dependant aspiration window delta
Mysseno [Fri, 14 Mar 2014 10:00:50 +0000 (21:00 +1100)]
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

10 years agoUse legal positions for endgame initialization
Marco Costalba [Fri, 14 Mar 2014 08:57:34 +0000 (09:57 +0100)]
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.

10 years agoFurther work in pos_is_ok()
Marco Costalba [Fri, 14 Mar 2014 08:43:19 +0000 (09:43 +0100)]
Further work in pos_is_ok()

No functional change.

10 years agoRe-add link time optimization on OS X
Daylen Yang [Fri, 14 Mar 2014 05:09:29 +0000 (22:09 -0700)]
Re-add link time optimization on OS X

In the new version of clang, -O4 does not imply -flto, so we set the
flag

10 years agoReformat do_castling()
Marco Costalba [Thu, 13 Mar 2014 11:53:03 +0000 (12:53 +0100)]
Reformat do_castling()

No functional change.

10 years agoFurther merge StateInfo setup functions
Marco Costalba [Wed, 12 Mar 2014 21:46:17 +0000 (22:46 +0100)]
Further merge StateInfo setup functions

No functional change.

10 years agoMerge hash key computation functions
Marco Costalba [Wed, 12 Mar 2014 08:14:38 +0000 (09:14 +0100)]
Merge hash key computation functions

No functional change.

10 years agoUse std::count in pos_is_ok()
Marco Costalba [Tue, 11 Mar 2014 22:19:47 +0000 (23:19 +0100)]
Use std::count in pos_is_ok()

No functional change.

10 years agoSmall simplification in gives_check
Marco Costalba [Tue, 11 Mar 2014 21:58:08 +0000 (22:58 +0100)]
Small simplification in gives_check

Use switch statement also for normal case.

No speed regression.

No functional change.

10 years agoPrint dbg counters after bench
Marco Costalba [Tue, 11 Mar 2014 21:19:14 +0000 (22:19 +0100)]
Print dbg counters after bench

Print last debug counters update just
before to exit benchmark.

Suggested by Stephane Nicolet.

No functional change.

10 years agoSimplify pseudo_legal()
Marco Costalba [Mon, 10 Mar 2014 07:38:23 +0000 (08:38 +0100)]
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.

10 years agoSimplify generate<EVASIONS>
Marco Costalba [Sun, 9 Mar 2014 10:48:41 +0000 (11:48 +0100)]
Simplify generate<EVASIONS>

No speed regression, tested with both perft and
bench.

No functional change.

10 years agoRetire SERIALIZE macros
Marco Costalba [Sun, 9 Mar 2014 10:03:02 +0000 (11:03 +0100)]
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.

10 years agoRename castling flag to castling right
Marco Costalba [Sat, 8 Mar 2014 14:08:55 +0000 (15:08 +0100)]
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.

10 years agoFix dbg_mean_of() for negative numbers
Stephane Nicolet [Wed, 5 Mar 2014 07:51:02 +0000 (08:51 +0100)]
Fix dbg_mean_of() for negative numbers

Type should be int64_t instead of uint64_t

No functional change.

10 years agoSome minor cleanup stuff
mstembera [Mon, 3 Mar 2014 07:07:57 +0000 (23:07 -0800)]
Some minor cleanup stuff

I came across while browsing the code.

No functional change.

10 years agoRevert dynamic draw value
Marco Costalba [Mon, 3 Mar 2014 07:39:34 +0000 (08:39 +0100)]
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

10 years agoPass CastlingFlag argument only
Marco Costalba [Sun, 2 Mar 2014 10:53:17 +0000 (11:53 +0100)]
Pass CastlingFlag argument only

Instead of Color and CastlingSide. Change functions API
accordingly.

No functional change.

10 years agoRemove limit of minimumSplitDepth
Marco Costalba [Sat, 1 Mar 2014 22:22:14 +0000 (23:22 +0100)]
Remove limit of minimumSplitDepth

There is no reason why an user cannot set
it at a value less than 4.

No functional change.

10 years agoRename xxx_to_char() -> to_char()
Marco Costalba [Sat, 1 Mar 2014 21:07:41 +0000 (22:07 +0100)]
Rename xxx_to_char() -> to_char()

No functional change.

10 years agoSimplify Bitboards::pretty
Marco Costalba [Sat, 1 Mar 2014 12:05:55 +0000 (13:05 +0100)]
Simplify Bitboards::pretty

No functional change.

10 years agoRetire UCI_AnalyseMode option
Marco Costalba [Sat, 1 Mar 2014 11:10:42 +0000 (12:10 +0100)]
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.