stockfish
11 years agoUse templetized operations for Square
Marco Costalba [Wed, 18 Aug 2010 15:40:26 +0000 (16:40 +0100)]
Use templetized operations for Square

This is tricky because there are some special
binary fnctions with SquareDelta that we should
leave as they are.

Also note that we needed to add Unary minus template
to fix a comile error in SERIALIZE_MOVES_D macro that was
triggered because now we don't allow conversion to int.

No fuctional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse templetized operations for File and Rank
Marco Costalba [Wed, 18 Aug 2010 15:17:20 +0000 (16:17 +0100)]
Use templetized operations for File and Rank

Doing the conversion the compiler is now able to
spot two possible ambiguity calls that now we can
easily fix.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse templetize enum operations for Depth
Marco Costalba [Wed, 18 Aug 2010 14:58:22 +0000 (15:58 +0100)]
Use templetize enum operations for Depth

Instead of hardcoded ones.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoStore in TT with depth == -OnePly instead of -1
Marco Costalba [Wed, 18 Aug 2010 14:20:24 +0000 (15:20 +0100)]
Store in TT with depth == -OnePly instead of -1

When depth < DEPTH_ZERO we store with the same depth all
the positions, use -OnePly instead of -1 for consistency
with depth arithmetic.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years ago(Re)introduce DEPTH_ZERO to replace Depth(0)
Marco Costalba [Wed, 18 Aug 2010 14:13:10 +0000 (15:13 +0100)]
(Re)introduce DEPTH_ZERO to replace Depth(0)

No functional changes.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire some unused Depth operator() functions
Marco Costalba [Wed, 18 Aug 2010 13:55:12 +0000 (14:55 +0100)]
Retire some unused Depth operator() functions

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRename OnePly in ONE_PLY
Marco Costalba [Wed, 18 Aug 2010 13:23:19 +0000 (14:23 +0100)]
Rename OnePly in ONE_PLY

Use enum values standard naming policy also for this one.

No fuctional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoDefine OnePly as a Depth enum costant
Marco Costalba [Wed, 18 Aug 2010 12:39:14 +0000 (13:39 +0100)]
Define OnePly as a Depth enum costant

There is no reason to use a variable for this.

Also remove unused DEPTH_ZERO and DEPTH_MAX.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRevert F_90 and F_92
Marco Costalba [Wed, 18 Aug 2010 09:05:28 +0000 (10:05 +0100)]
Revert F_90 and F_92

Regression test found the patches to be harmless,
so revert to keep code simpler.

Test1 at 20+0.1: (2500 - 3000) +0 ELO
Test2 at 1+0: (~1000) +2 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoCleanup and optimize Position::has_mate_threat()
Marco Costalba [Mon, 9 Aug 2010 10:45:02 +0000 (11:45 +0100)]
Cleanup and optimize Position::has_mate_threat()

There is a functional change because we now skip
more moves and because do_move() / undo_move() is
well known to be not reversible we end up with a
change in node count, although there is actually
no change but a bit speed up.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUsual material.cpp small touches
Marco Costalba [Sun, 8 Aug 2010 11:38:30 +0000 (12:38 +0100)]
Usual material.cpp small touches

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRename constants to use *_NONE scheme
Marco Costalba [Sat, 7 Aug 2010 17:40:04 +0000 (18:40 +0100)]
Rename constants to use *_NONE scheme

To be uniform across the sources. As a nice side effect
I quickly spotted a couple of needed renames:

captured_piece() -> captured_piece_type()
st->capture      -> st->capturedType

Proposed by Ralph and done with QtCreator

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoMove depth computation out of fail low loop
Marco Costalba [Fri, 6 Aug 2010 21:30:50 +0000 (22:30 +0100)]
Move depth computation out of fail low loop

In root_search() we can compute depth at the beginning
once and for all.

Spotted by Ralph Stoesser.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoAnother push to perft speed
Marco Costalba [Fri, 6 Aug 2010 11:01:21 +0000 (12:01 +0100)]
Another push to perft speed

We don't need to generate captures and non
captures in a separate step. This gives another
7% push to perft speed.

yes, I know, it is totally useless :-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFaster perft
Marco Costalba [Fri, 6 Aug 2010 09:47:42 +0000 (10:47 +0100)]
Faster perft

Skip moves scoring and sorting: this more then
doubles the speed !

Verified is correct.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRename TM in ThreadsMgr
Marco Costalba [Tue, 3 Aug 2010 12:06:56 +0000 (13:06 +0100)]
Rename TM in ThreadsMgr

This avoid misunderstandings with new TimeManager
object called TimeMgr.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoTimeManager API rename
Marco Costalba [Tue, 3 Aug 2010 09:58:13 +0000 (11:58 +0200)]
TimeManager API rename

We can now set member data as private because is no more
directly accessed.

Should be more clear now.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoMove time related global variables under TimeManager
Marco Costalba [Tue, 3 Aug 2010 09:20:06 +0000 (11:20 +0200)]
Move time related global variables under TimeManager

Move OptimumSearchTime, MaximumSearchTime and
ExtraSearchTime in TimeManager.

Note that we remove an useless initialization to 0 because
these variables are used only with time management.

Also introduce and use TimeManager::available_time()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoIntroduce TimeManager class
Marco Costalba [Tue, 3 Aug 2010 09:10:16 +0000 (11:10 +0200)]
Introduce TimeManager class

Firt step in unifying all time management under
a single umbrella. Just introduced the class without
even member data.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSmall cleanup in search Step.5
Marco Costalba [Sun, 1 Aug 2010 14:38:00 +0000 (15:38 +0100)]
Small cleanup in search Step.5

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoReset bestMove before entering main moves loop
Marco Costalba [Sun, 1 Aug 2010 08:37:07 +0000 (09:37 +0100)]
Reset bestMove before entering main moves loop

After razoring, IID, null verification and singular
extension searches we have could have a dirty ss->bestMove,
restore to MOVE_NONE before to enter moves loop.

This should avoid to store in TT a stale move when
we fail low.

Tested together with previous patch that is the
one that gives ELO.

After 1152 games at 1+0 on my QUAD
Mod vs Orig +233 =716 -203 (+9 ELO)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse past SE information also for success cases
Marco Costalba [Sat, 31 Jul 2010 07:14:06 +0000 (08:14 +0100)]
Use past SE information also for success cases

If singular extension search was succesful in the past then
skip another the SE search and extend of one ply.

Another way to mitigate the cost of SE at the price of
some more spurious extension, but on 90% of cases info
is correct.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRename MaxSearchTime and AbsoluteMaxSearchTime
Marco Costalba [Mon, 2 Aug 2010 17:41:25 +0000 (18:41 +0100)]
Rename MaxSearchTime and AbsoluteMaxSearchTime

Renamed in OptimumSearchTime and MaximumSearchTime,
should be more clear now.

Suggested by Joona.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoTempletize xxx_time_for_MTG()
Marco Costalba [Mon, 2 Aug 2010 10:14:27 +0000 (12:14 +0200)]
Templetize xxx_time_for_MTG()

Also fixed some warnings under MSVC.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoLittle timeman.cpp massage
Marco Costalba [Mon, 2 Aug 2010 09:34:19 +0000 (11:34 +0200)]
Little timeman.cpp massage

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoTweak default values for ucioptions
Joona Kiiski [Mon, 26 Jul 2010 13:39:10 +0000 (16:39 +0300)]
Tweak default values for ucioptions

I created three different systems, tested them all separately and
attached one did best:

1/40: Orig - Mod: 841 - 850 (+2 elo)
1+1 : Orig - Mod: 474 - 498 (+9 elo)
1+0 : Orig - Mod: 455 - 495 (+15 elo)

Because such testing system is not statistically reliable, I made a
confirmation test:

1/40: Orig - Mod: 502 - 543 (+14 elo)
1+1: Orig - Mod: 447 - 489 (+16 elo)
1+0: Orig - Mod: 641 - 656 (+4 elo)

All tests show positive score :-)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoNew Time management system
Joona Kiiski [Sun, 11 Jul 2010 16:23:50 +0000 (19:23 +0300)]
New Time management system

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoAlways use ss->bestMove to store ply best move
Marco Costalba [Sat, 31 Jul 2010 06:29:29 +0000 (07:29 +0100)]
Always use ss->bestMove to store ply best move

Instead of ss->currentMove. It is more consistent and
clear to understand.

Remark by Ralph Stoesser.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoLower SingularExtensionDepth to 7 plies for non-pv
Marco Costalba [Wed, 28 Jul 2010 07:39:28 +0000 (09:39 +0200)]
Lower SingularExtensionDepth to 7 plies for non-pv

To compensate for the extra work skip singular
searches deemed to fail because excluded node
failed high already in the past.

After 1200 games at 1+0
Mod vs Orig +387 =1274 -339  (+8 ELO)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoTwo small fixes in passed pawns evaluation
Marco Costalba [Mon, 26 Jul 2010 05:07:34 +0000 (06:07 +0100)]
Two small fixes in passed pawns evaluation

The one in evaluate_passed_pawns() is just a micro
optimization, the other in evaluate_unstoppable_pawns()
is indeed a fix, although almost unmeasurable in real
games.

Bugs report and fixes by Marek Kwiatkowski

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix KBNK endgame
Marco Costalba [Sun, 25 Jul 2010 20:47:54 +0000 (21:47 +0100)]
Fix KBNK endgame

Broken by recent patch. Also better document what's
happening there.

Verified to restore original behaviour.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRename EMPTY in NO_PIECE
Marco Costalba [Sun, 25 Jul 2010 11:10:22 +0000 (12:10 +0100)]
Rename EMPTY in NO_PIECE

It is more correct and more in line with enum PieceType

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoIntroduce enum SquareColor
Marco Costalba [Sun, 25 Jul 2010 10:44:03 +0000 (11:44 +0100)]
Introduce enum SquareColor

Square and piece colors are two different things,
so use different types to avoid misunderstandings.

Suggested by Tord.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoIntroduce and use same_color_squares()
Marco Costalba [Sun, 25 Jul 2010 10:05:01 +0000 (11:05 +0100)]
Introduce and use same_color_squares()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoCleanup Position::print()
Marco Costalba [Sun, 25 Jul 2010 08:52:06 +0000 (09:52 +0100)]
Cleanup Position::print()

And remove not used OUTSIDE enum Piece.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix build failure on GCC
Joona Kiiski [Sun, 25 Jul 2010 06:52:11 +0000 (09:52 +0300)]
Fix build failure on GCC

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoCleanup Position::to_fen()
Marco Costalba [Sat, 24 Jul 2010 16:59:18 +0000 (17:59 +0100)]
Cleanup Position::to_fen()

Less invasive then previous patches, but still a good
enhancement.

Also some indulge on STL algorithms :-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoLast touches to from_fen()
Marco Costalba [Sat, 24 Jul 2010 15:19:46 +0000 (16:19 +0100)]
Last touches to from_fen()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRewrite Position::from_fen()
Marco Costalba [Fri, 23 Jul 2010 08:38:19 +0000 (10:38 +0200)]
Rewrite Position::from_fen()

Complete rewrite the function and extend compatibility
also to X-FEN notation for Chess960.

We are now able to read standard FEN, Shredder-FEN and X-FEN.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoDon't initialize psqt-tables when 'ucinewgame' is received
Joona Kiiski [Fri, 23 Jul 2010 06:16:33 +0000 (09:16 +0300)]
Don't initialize psqt-tables when 'ucinewgame' is received

After 'Randomness' is retired, this is no longer necessary.

NOTE: Possibly some extra care is needed when tuning branch is synced

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire 'Randomness' ucioption
Joona Kiiski [Fri, 23 Jul 2010 06:08:31 +0000 (09:08 +0300)]
Retire 'Randomness' ucioption

Using multiple threads and good opening book is
much better and more reliable source of randomness than
spoiling psqt-tables

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoAlways init pthread locks to NULL
Joona Kiiski [Fri, 23 Jul 2010 05:45:42 +0000 (08:45 +0300)]
Always init pthread locks to NULL

This is the only way to keep Windows and POSIX behaviour in sync,
so better hardcode it.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRemove other locking options
Joona Kiiski [Fri, 23 Jul 2010 05:26:54 +0000 (08:26 +0300)]
Remove other locking options

Currently broken and we use pthreads in search.cpp
anyway, so I see no reason to keep these around

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire SearchStack init() and initKillers()
Marco Costalba [Fri, 23 Jul 2010 01:42:27 +0000 (02:42 +0100)]
Retire SearchStack init() and initKillers()

Let be explicit about what this functions do, and
we save some code lines too.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix errouneus reset of ss->threatMove
Marco Costalba [Fri, 23 Jul 2010 01:26:10 +0000 (02:26 +0100)]
Fix errouneus reset of ss->threatMove

After we set ss->threatMove we could go under a IID step that
resets SearchStack ss and so also ss->threatMove.

When later we use that field in futility pruning we have this
set to MOVE_NONE !

The fix is to use a local variable and add threatMove to SplitPoint
to pass this move to slaves.

Spotted by Ralph Stoesser, fix suggested by Richard Vida.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRevert previous patch
Marco Costalba [Thu, 22 Jul 2010 17:29:36 +0000 (18:29 +0100)]
Revert previous patch

Improvement is easily in error bar and there is
some added complexity making future changes more
difficult.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoWeight backward-ness of a pawn
Marco Costalba [Mon, 19 Jul 2010 06:56:14 +0000 (08:56 +0200)]
Weight backward-ness of a pawn

Because not all backward pawns are the same ;-) if the
blocking enemy pawn is near then our pawn is more backward
than another whose enemy pawn is far away so that can advance
for some sqaures.

After 2925 games at 30"+0 on my QUAD
Mod vs Orig +602 =1745 -578 +3 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoValueType needs only 2 bits to be stored in TT
Joona Kiiski [Thu, 22 Jul 2010 13:11:08 +0000 (16:11 +0300)]
ValueType needs only 2 bits to be stored in TT

Also update some more TT documentation

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUpdate TT documentation
Joona Kiiski [Thu, 22 Jul 2010 12:52:22 +0000 (15:52 +0300)]
Update TT documentation

Update outdated and even misleading documentation.

Also check #include-directives

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoMove insert_pv() and extract_pv() out of TT class
Marco Costalba [Wed, 21 Jul 2010 06:31:11 +0000 (08:31 +0200)]
Move insert_pv() and extract_pv() out of TT class

These functions have little to do with TranspositionTable
class and more with the search and in particular with the PV
handling. So move them where they belong.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoStore position static score in TT as soon as possible
Marco Costalba [Tue, 20 Jul 2010 21:36:38 +0000 (22:36 +0100)]
Store position static score in TT as soon as possible

So to maximize the possibility to avoid to recalculate it
in the future. A small speed-up of 0.8%

Idea by Ralph Stoesser.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoIntroduce DEPTH_NONE and use it
Marco Costalba [Tue, 20 Jul 2010 07:16:16 +0000 (09:16 +0200)]
Introduce DEPTH_NONE and use it

Also better fix previous patch.

Suggestions by Joona and Ralph.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRemove pointless tte->static_value() != VALUE_NONE checks
Joona Kiiski [Mon, 19 Jul 2010 15:48:16 +0000 (18:48 +0300)]
Remove pointless tte->static_value() != VALUE_NONE checks

Now in non-check nodes we are guaranteed to always have static value
in TT Entry.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoStore static value and king danger in TT also in TT.insert_pv() method
Joona Kiiski [Sun, 18 Jul 2010 21:19:09 +0000 (00:19 +0300)]
Store static value and king danger in TT also in TT.insert_pv() method

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix "pass ss->eval to qsearch()" condition
Marco Costalba [Mon, 19 Jul 2010 11:28:33 +0000 (12:28 +0100)]
Fix "pass ss->eval to qsearch()" condition

The seocond check is no more needed now and
anyhow is wrong to overwrite a TT entry if
present.

Spotted by Ralph Stoesser.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoTriviality in material.cpp
Marco Costalba [Mon, 19 Jul 2010 07:08:28 +0000 (09:08 +0200)]
Triviality in material.cpp

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSmall rewrite of backward pawn test
Marco Costalba [Mon, 19 Jul 2010 06:13:50 +0000 (07:13 +0100)]
Small rewrite of backward pawn test

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoInitialize SearchStack only once at RootMoveList c'tor
Joona Kiiski [Sun, 18 Jul 2010 21:01:58 +0000 (00:01 +0300)]
Initialize SearchStack only once at RootMoveList c'tor

Just fix current ugly behaviour :-)

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoEvery node is responsible for initializing its own SearchStack entry
Joona Kiiski [Sun, 18 Jul 2010 20:54:40 +0000 (23:54 +0300)]
Every node is responsible for initializing its own SearchStack entry

More logical than doing partly initialization at init_ss_array()

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoDrop KILLER_MAX. Hardcode to 2 instead.
Joona Kiiski [Sun, 18 Jul 2010 20:52:03 +0000 (23:52 +0300)]
Drop KILLER_MAX. Hardcode to 2 instead.

KILLER_MAX in search.h is quite pointless, because
we already hardcode this to 2 in MovePicker anyway.

By hard-coding this to 2 we can keep code simpler.

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoDo not initialize ss->reduction to zero in the beginning of node
Joona Kiiski [Sun, 18 Jul 2010 20:35:57 +0000 (23:35 +0300)]
Do not initialize ss->reduction to zero in the beginning of node

It must already be zero because zeroed in SearchStack initialization

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoDo not reset ss->eval in the beginning of the node
Joona Kiiski [Sun, 18 Jul 2010 13:24:07 +0000 (16:24 +0300)]
Do not reset ss->eval in the beginning of the node

This avoids problems with IID clearing ss->eval and
eval not being available when we return

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix isolated and backward pawns scoring
Marco Costalba [Sat, 17 Jul 2010 16:32:54 +0000 (17:32 +0100)]
Fix isolated and backward pawns scoring

It is more clear and also more correct because we
consider enemy pawns only in fornt of us and not just
on our file.

Very small functional change, almost not measurable, but
keep the patch for documenting purposes.

Spotted by Marek Kwiatkowski.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoTriviality in endgame.cpp
Marco Costalba [Sat, 17 Jul 2010 13:00:25 +0000 (14:00 +0100)]
Triviality in endgame.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUpdate Makefile
Joona Kiiski [Fri, 16 Jul 2010 06:12:46 +0000 (09:12 +0300)]
Update Makefile

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFind balance between 1.7 and 1.8 reductions
Joona Kiiski [Sat, 3 Jul 2010 05:14:31 +0000 (08:14 +0300)]
Find balance between 1.7 and 1.8 reductions

Almost no change so commit because is a pruning
reduction patch.

After 1088 games at 1'+0 with QUAD
Mod vs Orig +178 =727 -183  (-2 ELO)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRemove redundant argument in think()
Marco Costalba [Thu, 15 Jul 2010 15:05:56 +0000 (17:05 +0200)]
Remove redundant argument in think()

We don't need to pass side_to_move because we can get
it directly from the position object.

Note that in benchmark we always used to pass '0' and
it was a bug, but with no effect because was used only
in time[] and increment[], set always to 0 for both
colors.

Also additional small cleanup while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire apply_scale_factor() and scale.h
Marco Costalba [Thu, 15 Jul 2010 13:45:27 +0000 (15:45 +0200)]
Retire apply_scale_factor() and scale.h

Directly inline in the only occurence.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoInline history and gain getters
Marco Costalba [Thu, 15 Jul 2010 13:31:12 +0000 (15:31 +0200)]
Inline history and gain getters

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire value.cpp
Marco Costalba [Thu, 15 Jul 2010 09:00:20 +0000 (11:00 +0200)]
Retire value.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRetire LSN machinery
Marco Costalba [Wed, 14 Jul 2010 12:21:28 +0000 (14:21 +0200)]
Retire LSN machinery

Now that we use cutechess-cli we can set the auto-resign
parameter that makes LSN less effective.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoTriviality in ucioption.cpp
Marco Costalba [Wed, 14 Jul 2010 13:12:09 +0000 (15:12 +0200)]
Triviality in ucioption.cpp

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoAdd moves from failed high nodes in PV
Marco Costalba [Sat, 10 Jul 2010 10:55:56 +0000 (11:55 +0100)]
Add moves from failed high nodes in PV

Considering only VALUE_TYPE_EXACT nodes is too
restrictive and has a number of side-effects, most
notably the truncation of PV line after a fail high
at root.

Note that in this way we are no more guaranteed that
PV line is built up with PV nodes only, because
it could happen that a side search overwrites with a
cut-off move a PV node and this cut-off move ends up
in PV.

Change should be almost not measurable, perhaps with
ponder on we could have some beneficial effect.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix (zugzwang) verification to be shallower then null search
Marco Costalba [Sun, 11 Jul 2010 06:52:05 +0000 (07:52 +0100)]
Fix (zugzwang) verification to be shallower then null search

Currently starting from depth 12*OnePly on we have a verification
search deeper then the null search.

Note that, although reduction is R we start from one ply less then
null search, so actually we reach a depth that is OnePly shallower
then null search.

After 1130 games at 1'+0 on QUAD
Mod vs Orig +202 =756 -172  +9 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRemove TranspositionTable::overwrites variable
Joona Kiiski [Sun, 11 Jul 2010 17:22:30 +0000 (20:22 +0300)]
Remove TranspositionTable::overwrites variable

Doesn't provide useful information and
can cause slowdown with many Threads.

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoSpace inflate bitbase.cpp
Marco Costalba [Sun, 11 Jul 2010 09:47:04 +0000 (10:47 +0100)]
Space inflate bitbase.cpp

Also heavy cleanup while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoThere is no need to clear TT at allocation time
Marco Costalba [Sun, 11 Jul 2010 08:42:04 +0000 (09:42 +0100)]
There is no need to clear TT at allocation time

Operator new() already returns a zeroed memory.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRevert previous patch
Marco Costalba [Sat, 10 Jul 2010 15:38:54 +0000 (16:38 +0100)]
Revert previous patch

After the previous patch, it's impossible to build
anything else than x86 32-bit binary!

So revert.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoMakefile: default on gcc 32 bits when type 'make'
Marco Costalba [Sat, 10 Jul 2010 11:15:13 +0000 (12:15 +0100)]
Makefile: default on gcc 32 bits when type 'make'

From Vratko Polak

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoReword singular extension comments
Marco Costalba [Tue, 6 Jul 2010 08:08:35 +0000 (10:08 +0200)]
Reword singular extension comments

Should be more stick to original definition (Hsu, Campbell)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTweak Makefile a bit
Joona Kiiski [Mon, 5 Jul 2010 04:56:24 +0000 (07:56 +0300)]
Tweak Makefile a bit

To fix some build problems on debian's
automatic building system.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMove SplitPoint array under its thread
Marco Costalba [Mon, 5 Jul 2010 12:22:53 +0000 (14:22 +0200)]
Move SplitPoint array under its thread

And cleanup / rename that part of code.

No functional change also with faked split.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTweak non-captures scoring
Marco Costalba [Sat, 3 Jul 2010 05:02:06 +0000 (06:02 +0100)]
Tweak non-captures scoring

Tested with Orig set at f5ef5632f so to evaluate
direct gain against 1.8

After 3239 games at 10"+0.1
Mod vs Orig +701 =1906 -632 +7 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix TT documentation
Joona Kiiski [Sun, 4 Jul 2010 19:09:40 +0000 (22:09 +0300)]
Fix TT documentation

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoReintroduce GCC/ICC rounding hack
Marco Costalba [Sat, 3 Jul 2010 18:04:05 +0000 (19:04 +0100)]
Reintroduce GCC/ICC rounding hack

Unfortunatly the source of this issue is not in the
different handling of log(0) illegal value.

No functional change on MSVC.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix Makefile for HPUX
Joona Kiiski [Sat, 3 Jul 2010 16:28:51 +0000 (19:28 +0300)]
Fix Makefile for HPUX

On hpux there is no prefetch.

Reported by Richard Lloyd

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix DIVIDE BY ZERO exception in init_search()
Marco Costalba [Sat, 3 Jul 2010 15:02:07 +0000 (16:02 +0100)]
Fix DIVIDE BY ZERO exception in init_search()

It happens that when d == 0 we calculate:

log(double(0 * 0) / 2)

Unfortunately, log(0) is "illegal" and can generate either a
floating point exception or return a nonsense "huge" value
depending on the platform.

This fixs in the proper way the GCC/ICC rounding difference,
bug was from our side, not in the intel compiler.

Also fixed some few other warnings.

Bug spotted by Richard Lloyd.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoPSQT access functions can be static
Marco Costalba [Sat, 3 Jul 2010 04:48:43 +0000 (05:48 +0100)]
PSQT access functions can be static

Also renamed history access value in something more
in line with the meaning.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse only history to score non-captures
Marco Costalba [Fri, 25 Jun 2010 21:55:52 +0000 (22:55 +0100)]
Use only history to score non-captures

It seems there is absolutely no difference in using gains.

After 7025 games at 5"+0
Mod vs Orig +1903 =3236 -1886 (+1 ELO)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRestore development version
Marco Costalba [Sat, 3 Jul 2010 04:34:57 +0000 (05:34 +0100)]
Restore development version

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRevert "Another PSQT tuning round"
Marco Costalba [Fri, 2 Jul 2010 05:53:04 +0000 (06:53 +0100)]
Revert "Another PSQT tuning round"

At longer TC of 1'+0" patch fails:
Orig - Mod: 841 - 819 (-6 elo!)

Just before the release ;-)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoStockfish 1.8
Marco Costalba [Fri, 2 Jul 2010 05:23:15 +0000 (06:23 +0100)]
Stockfish 1.8

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMark CheckInfo c'tor as explicit
Marco Costalba [Thu, 1 Jul 2010 21:21:09 +0000 (22:21 +0100)]
Mark CheckInfo c'tor as explicit

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMove singleEvasion assignment out of move's loop
Marco Costalba [Thu, 1 Jul 2010 21:18:53 +0000 (22:18 +0100)]
Move singleEvasion assignment out of move's loop

We don't need to recheck after every move.

Spotted by Ralph Stoesser.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAnother PSQT tuning round
Joona Kiiski [Wed, 17 Mar 2010 06:32:26 +0000 (08:32 +0200)]
Another PSQT tuning round

This time with a new algorithm by Joona.

It works basically like this:

repeat
{
   1) pick 8000 random positions from qsearch
   2) "go depth 8" to get the true evaluation.
   3) "eval" to get the stand pat score
   4) Adjusting parameters one by one to minimize deltasum between
true evaluation and stand  pat scores.
}

* Good news: method seems to converge
* Bad news: Point where it converges is not optimum.

So it's more or less trial and error... sometimes works, sometimes
doesn't. It can give you the right direction, but if you let it run
too long, it fails. Far from scientific ;)

After 14800 games with 5s/game
Orig - Mod: 3318 - 3570 - 7626 (+6 elo)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove a redundant check in passed pawn eval
Marco Costalba [Tue, 29 Jun 2010 11:05:19 +0000 (13:05 +0200)]
Remove a redundant check in passed pawn eval

When first condition is met then second one is
always true.

Spotted by Ralph Stoesser.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoCode style triviality in san.cpp
Marco Costalba [Tue, 29 Jun 2010 10:14:44 +0000 (12:14 +0200)]
Code style triviality in san.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRename TranspositionTable 'writes' in 'overwrites'
Marco Costalba [Mon, 28 Jun 2010 07:20:34 +0000 (08:20 +0100)]
Rename TranspositionTable 'writes' in 'overwrites'

Better documents what that variable means.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoExtract only exact scores to get the PV
Marco Costalba [Sun, 27 Jun 2010 14:13:22 +0000 (15:13 +0100)]
Extract only exact scores to get the PV

This should allow to skip overwritten nodes because
only in PV we store in TT with VALUE_TYPE_EXACT flag.

Test result for the whole series is:

After 3627 games at 5"
Mod vs Orig +1037 =1605 -985 +5 ELO

After 1311 games at 1'+0"
Mod vs Orig +234 =850 -227 +2 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire update_pv() and sp_update_pv()
Marco Costalba [Sat, 26 Jun 2010 14:22:13 +0000 (15:22 +0100)]
Retire update_pv() and sp_update_pv()

Expand inline instead.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>