stockfish
12 years agoThread::splitPoint is a volatile pointer
Marco Costalba [Mon, 31 May 2010 05:13:34 +0000 (06:13 +0100)]
Thread::splitPoint is a volatile pointer

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDo IID also when we already have a ttMove
Marco Costalba [Sat, 29 May 2010 09:01:25 +0000 (10:01 +0100)]
Do IID also when we already have a ttMove

In case tte->depth() is far lower the current depth
and we are in a PV node.

Almost 45% of researches give a different ttMove !

After 999 games at 1+0
Mod vs Orig +174 =694 -131 +15 ELO !!!!!!!

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIf LMR search fails high research at intemediate depth
Marco Costalba [Fri, 28 May 2010 22:31:05 +0000 (23:31 +0100)]
If LMR search fails high research at intemediate depth

Do not search immediately at full depth, but try a second
chance at lower depth. This is a feature that should scale
well because become important at high depths where we have
big reductions and also big savings in avoiding a costly
full depth search.

After 942 games at 1+0
Mod vs Orig +158 =645 -139  +7 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix IIDMargin description
Marco Costalba [Sat, 29 May 2010 08:43:18 +0000 (09:43 +0100)]
Fix IIDMargin description

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire zobMaterial[]
Marco Costalba [Sat, 29 May 2010 07:54:15 +0000 (08:54 +0100)]
Retire zobMaterial[]

Use zobrist[] array to compute material key.

Space save of 2KB in L1 cache.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoChange zobMaterial[] index 0 definition
Marco Costalba [Fri, 28 May 2010 11:21:03 +0000 (12:21 +0100)]
Change zobMaterial[] index 0 definition

The index at 0 was reserved for no-pieces
information. But we don't need that.

This is a prerequisite for next patch.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse Key type instead of Bitboard
Marco Costalba [Sat, 29 May 2010 07:11:36 +0000 (08:11 +0100)]
Use Key type instead of Bitboard

They are both 64 bits unsigned integer, but it
is correct to use the proper type.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRevert non-linear threats evaluation
Marco Costalba [Sun, 23 May 2010 13:51:15 +0000 (14:51 +0100)]
Revert non-linear threats evaluation

After 999 games at 1+0
Mod vs Orig +148 =712 -139 +3 ELO

The added complexity doesn't seems to pay off and could
even scale worst with longer TC. So revert.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove an useless assert in evaluate_passed_pawns()
Marco Costalba [Sat, 22 May 2010 18:14:19 +0000 (19:14 +0100)]
Remove an useless assert in evaluate_passed_pawns()

The tested square comes from a bitboard anded with
pos.pieces_of_color(Us), so assert is useless.

Another nitpick report by Marek Kwiatkowski  ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAccount for double pawn push in evaluate_unstoppable_pawns()
Marco Costalba [Sat, 22 May 2010 17:38:45 +0000 (18:38 +0100)]
Account for double pawn push in evaluate_unstoppable_pawns()

One of the most nitpicking patches I have ever seen.

Of course almost no functional change, but added just
becasue we are very pedantic ;-)

Spotted by Marek Kwiatkowski

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix StormOpenFileBonus[] bug
Marco Costalba [Mon, 17 May 2010 05:08:47 +0000 (06:08 +0100)]
Fix StormOpenFileBonus[] bug

It was erroneusly reversed. Bug from Glaurung times.
Probably a full re-tuning is needed anyhow.

Spotted and fixed by Ralph Stoesser.

After 999 games almost no change, but modified anyway
for documentation reasons.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix a warning on array of size 0 under Windows
Marco Costalba [Sat, 22 May 2010 11:45:05 +0000 (12:45 +0100)]
Fix a warning on array of size 0 under Windows

And better document new reality.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDrop completely illogical ei.kingDanger == 0 requirement
Joona Kiiski [Sat, 22 May 2010 08:34:35 +0000 (11:34 +0300)]
Drop completely illogical ei.kingDanger == 0 requirement

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAlways save static value and kingDanger to TT
Joona Kiiski [Sat, 22 May 2010 08:56:46 +0000 (11:56 +0300)]
Always save static value and kingDanger to TT

Around 5% speed-up

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDrop TTClusterSize from 5 to 4
Joona Kiiski [Sat, 22 May 2010 08:51:22 +0000 (11:51 +0300)]
Drop TTClusterSize from 5 to 4

Very small obvious functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAdd non-linear threats evaluation
Marco Costalba [Sat, 22 May 2010 10:55:01 +0000 (11:55 +0100)]
Add non-linear threats evaluation

Increase threats score according to the number of
threats and to the side to move.

Constants have been balanced after ~34k iterations.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRevert "Simple implementation of strong YBWC"
Marco Costalba [Sat, 22 May 2010 10:35:15 +0000 (11:35 +0100)]
Revert "Simple implementation of strong YBWC"

It does not seem to increase anything even with a QUAD,
so revert.

After 1000 games with a QUAD
Mod - Orig: 500 - 497 (+1 elo)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAdd some automatic detection for Windows
Joona Kiiski [Fri, 21 May 2010 19:17:59 +0000 (22:17 +0300)]
Add some automatic detection for Windows

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDocumentation fix
Joona Kiiski [Fri, 21 May 2010 05:31:27 +0000 (08:31 +0300)]
Documentation fix

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoCorrect 'prefetch' handling for Makefile
Joona Kiiski [Fri, 21 May 2010 05:05:36 +0000 (08:05 +0300)]
Correct 'prefetch' handling for Makefile

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoLet prefetch to be enabled by default on Windows
Marco Costalba [Thu, 20 May 2010 20:37:37 +0000 (21:37 +0100)]
Let prefetch to be enabled by default on Windows

When compiling with MSVC we don't use the Makefile
so tweak a bit the Makefile to allow to let prefetch
in by default so that it works under Windows.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSmall tweaks to install gcc-profile-clean targets
Joona Kiiski [Thu, 20 May 2010 15:24:45 +0000 (18:24 +0300)]
Small tweaks to install gcc-profile-clean targets

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoModify source to follow new Makefile
Joona Kiiski [Wed, 19 May 2010 19:44:26 +0000 (22:44 +0300)]
Modify source to follow new Makefile

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRewrite Makefile
Joona Kiiski [Wed, 19 May 2010 17:37:56 +0000 (20:37 +0300)]
Rewrite Makefile

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSimple implementation of strong YBWC
Marco Costalba [Thu, 13 May 2010 08:06:27 +0000 (10:06 +0200)]
Simple implementation of strong YBWC

No gain in the worst case of 2 threads, but also no
loss and good potential for QUAD or OCTAL machines.

After 922 games at 1+0 with 2 threads

Mod vs Orig +143 =533 -143 +0 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove an assert in evaluate_passed_pawns()
Marco Costalba [Thu, 20 May 2010 16:48:19 +0000 (17:48 +0100)]
Remove an assert in evaluate_passed_pawns()

We already tested few lines before with:

assert(pos.pawn_is_passed(Us, s));

Spotted by Marek Kwiatkowski.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIndentation fix in middle-game evaluation
Marco Costalba [Mon, 17 May 2010 06:04:24 +0000 (07:04 +0100)]
Indentation fix in middle-game evaluation

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIntroduce init_attack_tables() in evaluate()
Marco Costalba [Sat, 15 May 2010 12:29:21 +0000 (13:29 +0100)]
Introduce init_attack_tables() in evaluate()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDo not consider discovered checks in king safety
Marco Costalba [Sat, 15 May 2010 12:00:32 +0000 (13:00 +0100)]
Do not consider discovered checks in king safety

Does not help and it slows downs a bit because it
is not cheap to get the possible discovered checks
out of a position.

After 997 games at 1+0
Mod vs orig +153 =692 -152  +0 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix RootMove::operator<() description
Marco Costalba [Sun, 16 May 2010 07:56:58 +0000 (08:56 +0100)]
Fix RootMove::operator<() description

Reported by Melvin Sprague.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove an useless Max() in passed pawns evaluation
Marco Costalba [Sat, 15 May 2010 23:56:05 +0000 (00:56 +0100)]
Remove an useless Max() in passed pawns evaluation

There is no reason for that since tr cannot become negative.

Spotted by Ralph Stoesser.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoThreath tuning results
Marco Costalba [Sat, 15 May 2010 20:44:57 +0000 (21:44 +0100)]
Threath tuning results

Final values for threath tuning (after ~30k iterations)

Verified to be equivalent with tuning branch.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAdd support for gcc-profile
Marco Costalba [Fri, 14 May 2010 16:12:10 +0000 (17:12 +0100)]
Add support for gcc-profile

It's now possible to build PGO builds with GCC

Patch from Oystein Johansen

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRename OutpostMask[] in AttackSpanMask[]
Marco Costalba [Fri, 14 May 2010 13:11:32 +0000 (15:11 +0200)]
Rename OutpostMask[] in AttackSpanMask[]

This is a more standard naming (see chessprogramming wiki)
and is more stick to what table is and not what is used for.

Code in pawns.cpp is a bit more readable now, at least for me ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMicro optimization in evaluate_pawns()
Marco Costalba [Fri, 14 May 2010 11:51:29 +0000 (12:51 +0100)]
Micro optimization in evaluate_pawns()

Avoid a double bitcount in test for candidate passed
pawn when we don't have any supporting pawn.

Also use outpost_mask() instead of build it up on
the fly.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIntroduce evaluate_pawn_storm() to unify redundant code
Marco Costalba [Fri, 14 May 2010 08:42:53 +0000 (10:42 +0200)]
Introduce evaluate_pawn_storm() to unify redundant code

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoCode style tweaks to pawns.cpp
Marco Costalba [Fri, 14 May 2010 07:47:11 +0000 (09:47 +0200)]
Code style tweaks to pawns.cpp

Also a small speedup.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoChange color argument of square_is_weak()
Marco Costalba [Fri, 14 May 2010 09:53:33 +0000 (11:53 +0200)]
Change color argument of square_is_weak()

Pass the color for which the square is to be
considered weak, not the opposite.

It is more natural and intuitive in this way.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSpace inflate marsenne
Marco Costalba [Thu, 13 May 2010 13:06:06 +0000 (15:06 +0200)]
Space inflate marsenne

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAnother split() tweak session
Marco Costalba [Thu, 13 May 2010 08:56:11 +0000 (10:56 +0200)]
Another split() tweak session

Function split() doesn't need to return a value, also
remove useless 'master' field.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDocument old test result
Joona Kiiski [Wed, 12 May 2010 11:46:54 +0000 (14:46 +0300)]
Document old test result

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove one hack caused by misunderstanding
Joona Kiiski [Wed, 12 May 2010 10:29:14 +0000 (13:29 +0300)]
Remove one hack caused by misunderstanding

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix a possible out of range access in previous patch
Marco Costalba [Wed, 12 May 2010 11:30:00 +0000 (12:30 +0100)]
Fix a possible out of range access in previous patch

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire splitPoint->cpus field
Marco Costalba [Wed, 12 May 2010 08:35:10 +0000 (10:35 +0200)]
Retire splitPoint->cpus field

It is redundant with splitPoint->slaves[].

Also move slaves[MAX_THREADS] among the shared data in
SplitPoint definition as it should have been already.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSyncing sp_search() and search()
Marco Costalba [Tue, 11 May 2010 13:29:54 +0000 (15:29 +0200)]
Syncing sp_search() and search()

Small twekas to make the two searches as similar as
possible.

Also removed an useless setting of mateKiller in sp_search()

No functional change (tested with FakeSplit)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSimplify init_safety()
Marco Costalba [Tue, 11 May 2010 08:40:14 +0000 (10:40 +0200)]
Simplify init_safety()

In this for is also ready to be tuned....to be continued ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoGreatly simplify weight_option()
Marco Costalba [Tue, 11 May 2010 08:07:17 +0000 (10:07 +0200)]
Greatly simplify weight_option()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSmall evaluate_passed_pawns() cleanup
Marco Costalba [Mon, 10 May 2010 10:27:33 +0000 (12:27 +0200)]
Small evaluate_passed_pawns() cleanup

Mainly renamed local variables with sensible names.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoBetter integration of faked split
Marco Costalba [Sun, 9 May 2010 22:31:43 +0000 (23:31 +0100)]
Better integration of faked split

We don't need to comment/uncomment code, just
set FakeSplit bool to true to enable faked split.

Also reintroduced some asserts and cleaned up a bit.

Tested that with FakeSplit = true we have reproducible
finger printing even in SMP.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDisable fake-mode
Joona Kiiski [Sun, 9 May 2010 19:04:21 +0000 (22:04 +0300)]
Disable fake-mode

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUnite sp_search() and sp_search_pv()
Joona Kiiski [Sun, 9 May 2010 18:59:39 +0000 (21:59 +0300)]
Unite sp_search() and sp_search_pv()

Also introduce a new rule:
In sp_search() always must hold: sp->alpha < sp->beta
Should fix some rear but very nasty races

To keep everything in sync, search() is also modified to
obey this rule. Because this affects only PV-nodes, should
have zero meaning to speed.

No functional change in fake mode

Regression test after 854 games
Mod vs Orig 433 - 421, no crashes.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIntroduce fake-mode for split
Joona Kiiski [Sun, 9 May 2010 10:20:55 +0000 (13:20 +0300)]
Introduce fake-mode for split

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRevert to old prefetch detection logic
Marco Costalba [Sun, 9 May 2010 12:03:58 +0000 (13:03 +0100)]
Revert to old prefetch detection logic

It was broken on Windows 64bit with MSVC and possibly
on other platforms, so revert to old proven one.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix an off-by-one bug in ThreatBonus[] table
Marco Costalba [Sun, 9 May 2010 09:30:50 +0000 (11:30 +0200)]
Fix an off-by-one bug in ThreatBonus[] table

We need a retuning anyhow.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTemplatize qsearch
Joona Kiiski [Sat, 8 May 2010 13:59:00 +0000 (16:59 +0300)]
Templatize qsearch

No functional change and 2% speed-up on GCC.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire mate threat detection from evaluation
Marco Costalba [Fri, 7 May 2010 07:39:28 +0000 (09:39 +0200)]
Retire mate threat detection from evaluation

Remove a lot of complex, obscure and useless code.

After 999 games at 1+0
Mod vs Orig +162 =673 -164 -1 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAdd a comment and a FIXME
Marco Costalba [Sat, 8 May 2010 12:30:34 +0000 (13:30 +0100)]
Add a comment and a FIXME

And fix indentation too.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoLookup TT for eval also in PV nodes
Marco Costalba [Sat, 8 May 2010 12:12:46 +0000 (13:12 +0100)]
Lookup TT for eval also in PV nodes

We don't need to evaluate the position if it
is already cached in TT. We already do this
in non-PV case.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix an obsoleted descrption comment
Marco Costalba [Sat, 8 May 2010 12:06:55 +0000 (13:06 +0100)]
Fix an obsoleted descrption comment

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUnify Internal iterative deepening
Marco Costalba [Sat, 8 May 2010 11:58:10 +0000 (12:58 +0100)]
Unify Internal iterative deepening

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTempletize extension() function
Marco Costalba [Sat, 8 May 2010 11:39:52 +0000 (12:39 +0100)]
Templetize extension() function

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTempletize reduction() functions
Marco Costalba [Sat, 8 May 2010 11:26:34 +0000 (12:26 +0100)]
Templetize reduction() functions

No functional or speed change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse enum NodeType instead of opaque true/false
Marco Costalba [Sat, 8 May 2010 10:47:00 +0000 (11:47 +0100)]
Use enum NodeType instead of opaque true/false

Increase readibility.

No functional and speed change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUnite search_pv() and search()
Joona Kiiski [Sat, 8 May 2010 08:54:51 +0000 (11:54 +0300)]
Unite search_pv() and search()

A lot of redundant code removed: -182 lines of code

No functional and speed change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRename AttackWeight[] in KingAttackWeights[]
Marco Costalba [Fri, 7 May 2010 09:36:25 +0000 (11:36 +0200)]
Rename AttackWeight[] in KingAttackWeights[]

Also simplify a bit the code removing useless
named constants.

No functional change.

12 years agoArray ThreatBonus[] is initialized at zero by compiler
Marco Costalba [Fri, 7 May 2010 09:17:26 +0000 (11:17 +0200)]
Array ThreatBonus[] is initialized at zero by compiler

We don't need to do the job.

No functional change.

12 years agoProperly indent evaluate_king()
Marco Costalba [Thu, 6 May 2010 18:10:04 +0000 (19:10 +0100)]
Properly indent evaluate_king()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRename futilityMargin in kingDanger in EvalInfo
Marco Costalba [Thu, 6 May 2010 12:22:53 +0000 (14:22 +0200)]
Rename futilityMargin in kingDanger in EvalInfo

This is what actually is.

A standard naming convention suggests to name a variable
with someting resembling _what_ the variable is and not
_how_ the variable is used. This normally results
in easier to read code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSimplify some obsolete code in king safety
Marco Costalba [Thu, 6 May 2010 09:13:07 +0000 (11:13 +0200)]
Simplify some obsolete code in king safety

Now that QueenCheckBonus and friends are always > 0
we can remove a bunch of useless 'if' statements.

No functional change.

12 years agoRename king "safety" to king "danger"
Marco Costalba [Thu, 6 May 2010 08:36:01 +0000 (10:36 +0200)]
Rename king "safety" to king "danger"

A bigger "safety" value is actually a bigger
threat for the king, so it is a bigger "danger"

With this renaming "Cowardice" and "Aggressiveness"
UCI parameters become easier to understand.

It is also easier to understand why the once "safety"
value (that is a "danger") is subtracted from evaluation
instead of being added.

No functional change.

12 years agoEvaluation weights cleanup
Marco Costalba [Thu, 6 May 2010 07:58:04 +0000 (09:58 +0200)]
Evaluation weights cleanup

Use a Weights[] array instead of named variables to
store evaluation weights.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSet Mate Threat Extension to OnePly
Marco Costalba [Thu, 6 May 2010 02:23:41 +0000 (03:23 +0100)]
Set Mate Threat Extension to OnePly

For both PV and non-PV nodes.

After 981 games at 1+0
Mod vs Orig +153 =686 -142 +4 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAvoid a call to apply_weight() in evaluate_king()
Marco Costalba [Sat, 1 May 2010 04:41:25 +0000 (05:41 +0100)]
Avoid a call to apply_weight() in evaluate_king()

Precompute scores in SafetyTable[] instead of calculate
them on the fly.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFurther push the LMR pedal
Joona Kiiski [Sun, 18 Apr 2010 16:12:47 +0000 (19:12 +0300)]
Further push the LMR pedal

More aggressive LMR reductions.

Tested at different time controls:

- Tested with 1CPU 1+0, after 3000 games, result was +12 ELO

- Tested this with 4CPU 1+0 and got sth around 5-10 ELO increase

- Last one at long time control,after ~1000 games with 10+0 result is:

Orig - Mod: 491 - 520 (+10 elo)

A testing marathon by Joona for this important change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoA promotion piece cannot be a king or a pawn
Marco Costalba [Sun, 2 May 2010 12:39:47 +0000 (13:39 +0100)]
A promotion piece cannot be a king or a pawn

Or any other garbage value bigger then QUEEN.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDo not return from idle_loop() with lock held
Marco Costalba [Sun, 2 May 2010 11:02:41 +0000 (12:02 +0100)]
Do not return from idle_loop() with lock held

Master thread returns from idle_loop() when sp->cpus == 0,
but cpus is decremented by slave threads under sp->lock,
so it could happen that we return in split(), where we release
the split point, with sp->lock still held.

This patch guarantees that sp->lock is released when returning
to split().

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoReverse the logic used to detect prefetch
Marco Costalba [Sun, 2 May 2010 08:28:37 +0000 (09:28 +0100)]
Reverse the logic used to detect prefetch

Explicitly search for x86 architecture instead of
excluding the others.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAllow a static evaluation to overwrite an exsisting entry
Marco Costalba [Sat, 1 May 2010 09:34:28 +0000 (10:34 +0100)]
Allow a static evaluation to overwrite an exsisting entry

The idea here is that if we cut-off after a stand pat the
already exsisting TT entry was not usable with current
beta, so overwrite anyway.

After 999 games at 1+0
Mod vs Orig +173 =665 -161  + 4 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDo not refresh TT in qsearch
Marco Costalba [Sat, 1 May 2010 05:12:04 +0000 (06:12 +0100)]
Do not refresh TT in qsearch

Almost no change and simplifies a bit the code.

After 961 games at 1+0
Mod vs Orig +156 =650 -146  +4 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRefresh TT entry after a cut-off to avoid aging
Marco Costalba [Thu, 29 Apr 2010 17:21:48 +0000 (18:21 +0100)]
Refresh TT entry after a cut-off to avoid aging

Re-save the same TT entry if value is usable and allow
us to cut-off, it means that entry is valuable and
we want to keep it fresh updating the 'generation'
parameter up to the current value.

Patch suggested by J. Wesley Cleveland and better
clarified by Miguel A. Ballicora.

After 999 games at 1+0 64MB hash size
Mod vs Orig +167 =677 -155 +4 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix compile error on GCC
Joona Kiiski [Mon, 26 Apr 2010 08:51:03 +0000 (11:51 +0300)]
Fix compile error on GCC

Add missing prototype.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoEndgame's apply() method can be 'const'
Marco Costalba [Tue, 27 Apr 2010 05:17:32 +0000 (06:17 +0100)]
Endgame's apply() method can be 'const'

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove an obsolete comment
Marco Costalba [Tue, 27 Apr 2010 04:00:45 +0000 (05:00 +0100)]
Remove an obsolete comment

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAnother small material tweak
Marco Costalba [Mon, 26 Apr 2010 12:43:03 +0000 (14:43 +0200)]
Another small material tweak

In this case we avoid to name the 'black' version of the
endgame function but use a vector indexed by color instead.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoCleanup material distribution detectors
Marco Costalba [Mon, 26 Apr 2010 09:42:46 +0000 (11:42 +0200)]
Cleanup material distribution detectors

No functional change (verified each function)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDo not call exit_threads() in Application d'tor
Marco Costalba [Sun, 25 Apr 2010 09:31:48 +0000 (10:31 +0100)]
Do not call exit_threads() in Application d'tor

Because exit_threads() references the global object TM, we
need to call the function when still inside main(), otherwise,
due to undefined global object initialization and destruction
we could end up with referencing an already destroyed object.

Actually this should not happen because Application singleton
is initialized _only_ after all the other globals due to how
Application::initialize() is defined, but this is very tricky
C++ and not easy to follow, even for me ;-)

Also rearranged a bit main() code flow.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSmall passed pawns evaluation cleanup
Marco Costalba [Sun, 25 Apr 2010 07:39:24 +0000 (08:39 +0100)]
Small passed pawns evaluation cleanup

Moved evaluation of unstoppable pawns out of
evauation of passed pawns because event frequency is
much lower. Added evaluate_unstoppable_pawns() that
is called very seldom and contains all the unstoppable
pawn logic.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSimplify a bit futility marging formula
Marco Costalba [Wed, 21 Apr 2010 19:42:34 +0000 (20:42 +0100)]
Simplify a bit futility marging formula

Should be a very minor change, but there is a small
functional change because futility_margin() is used in more
places then in the pruning formula.

After 999 games at 1+0
Mod vs Orig +167 =678 -154  +5 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRevert scale factor in pawn evaluation
Marco Costalba [Wed, 21 Apr 2010 19:35:47 +0000 (20:35 +0100)]
Revert scale factor in pawn evaluation

It simply doesn't seems to work both in direct matches
and in balance tuning.

So revert the idea.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIntroduce PawnsQtyTable[] to refine pawn's drawish calculation
Marco Costalba [Mon, 19 Apr 2010 07:06:34 +0000 (09:06 +0200)]
Introduce PawnsQtyTable[] to refine pawn's drawish calculation

Also fix dimension of UnpairedPawnsTable[] to accomodate the
case in which we have 8 unpaired pawns, i.e. only one side has
pawns, the other side has no pawns.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFirst attempt at tweaking UnpairedPawnsTable[] values
Marco Costalba [Mon, 19 Apr 2010 05:37:07 +0000 (06:37 +0100)]
First attempt at tweaking UnpairedPawnsTable[] values

Values by Joona.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIntroduce scale factor in pawn evaluation
Marco Costalba [Sun, 18 Apr 2010 09:25:59 +0000 (10:25 +0100)]
Introduce scale factor in pawn evaluation

The idea is to reduce the score if we have many
pawns opposing an enemy pawn so that the draw
possibility increases.

Just introduced the logic, but no functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix candidate passed pawn definition
Marco Costalba [Sun, 18 Apr 2010 09:09:12 +0000 (10:09 +0100)]
Fix candidate passed pawn definition

A pawn is candidate to be passed if doesn't have enemy pawns
in just front of him, not also behind !

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire Position::pawn_is_passed() and friends
Marco Costalba [Sun, 18 Apr 2010 08:58:57 +0000 (09:58 +0100)]
Retire Position::pawn_is_passed() and friends

Absolutely no useful at all, just code obfuscation so
use real definition instead.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIntroduce table SquaresInFrontMask[2][64]
Marco Costalba [Sun, 18 Apr 2010 08:45:23 +0000 (09:45 +0100)]
Introduce table SquaresInFrontMask[2][64]

It will be used to lookup squares in front of
a given square. Same concept of PassedPawnMask[]
and OutpostMask[].

Also small tweaks in bitboard.h

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoBetter perft integration in benchmark
Marco Costalba [Sun, 18 Apr 2010 08:18:49 +0000 (09:18 +0100)]
Better perft integration in benchmark

Now with:

   stockfish bench 128 1 5 default perft

it is possible to get perft 5 results of each position and
the first 3 positions correspond to the well known test
position in:

http://chessprogramming.wikispaces.com/Perft+Results

This allow to quickly check for perft consistency running
the 'bench' command.

No functional change but signature has changed because
bench default positions 2 and 3 have changed.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSpace inflate bitboard.cpp
Marco Costalba [Sun, 18 Apr 2010 06:57:34 +0000 (07:57 +0100)]
Space inflate bitboard.cpp

This file, somehow, avoided the "space inflate" treatment...until now ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoConvert polyglot.ini to use Linux line ending
Marco Costalba [Sat, 17 Apr 2010 10:24:25 +0000 (11:24 +0100)]
Convert polyglot.ini to use Linux line ending

Instead of Windows cr/lf

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTeach polyglot the new "Best Book Move" UCI option
Marco Costalba [Sat, 17 Apr 2010 10:22:40 +0000 (11:22 +0100)]
Teach polyglot the new "Best Book Move" UCI option

Also turn off log by default as is in UCI case.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRevert saving of null search value in TT
Marco Costalba [Fri, 16 Apr 2010 05:19:33 +0000 (06:19 +0100)]
Revert saving of null search value in TT

Revert all the patches that introduced the change and
more or less fixed the zugzwang issue.

There is a gain against last current version and we
can remove a lot of code.

After 979 games at 1+0 on my QUAD
Mod vs Orig +152 =688 -139 +5 ELO

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