stockfish
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 years agoRetire pv[] from SearchStack
Marco Costalba [Sat, 26 Jun 2010 14:05:38 +0000 (15:05 +0100)]
Retire pv[] from SearchStack

Extract PV info from TT instead of using
a set of arrays. This is almost equivalent
except for cases when TT is full and the PV entry
is overwritten, but this is very rare.

(Almost) No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoIntroduce bestMove to store PV move
Marco Costalba [Sat, 26 Jun 2010 13:42:44 +0000 (14:42 +0100)]
Introduce bestMove to store PV move

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoCleanup code that stores score in TT
Marco Costalba [Sat, 26 Jun 2010 09:43:59 +0000 (10:43 +0100)]
Cleanup code that stores score in TT

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoFix some wrong documentation
Joona Kiiski [Sat, 26 Jun 2010 08:12:32 +0000 (11:12 +0300)]
Fix some wrong documentation

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoRemove unused constant
Joona Kiiski [Sat, 26 Jun 2010 08:09:06 +0000 (11:09 +0300)]
Remove unused constant

Fixes warning on ICC

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoStockfish 1.8 beta 2
Marco Costalba [Fri, 25 Jun 2010 17:56:42 +0000 (18:56 +0100)]
Stockfish 1.8 beta 2

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoHack to fix GCC/ICC rounding difference
Joona Kiiski [Fri, 25 Jun 2010 17:49:36 +0000 (20:49 +0300)]
Hack to fix GCC/ICC rounding difference

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoStockfish 1.8 beta 1
Marco Costalba [Thu, 24 Jun 2010 16:56:45 +0000 (17:56 +0100)]
Stockfish 1.8 beta 1

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoRevert "Do IID also when we already have a ttMove"
Marco Costalba [Thu, 24 Jun 2010 17:00:03 +0000 (18:00 +0100)]
Revert "Do IID also when we already have a ttMove"

Joona's testing reports very bad results at 5s, 30s and
even 1 minute TC, so revert.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoCall apply_weight() for both colors in one go
Marco Costalba [Sat, 5 Jun 2010 17:05:29 +0000 (18:05 +0100)]
Call apply_weight() for both colors in one go

Due to rounding errors in apply_weight() where we divide
by 0x100 it is not possible to keep some functionality.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoTweak unstoppable pawns detection
Marco Costalba [Sun, 13 Jun 2010 10:05:04 +0000 (11:05 +0100)]
Tweak unstoppable pawns detection

A pawn is unstoppable also if enemy king can reach it
but path to queening is protected.

Original idea by Ralph Stoesser fixed by me.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoMerge branch 'master' of free2.projectlocker.com:sf
Marco Costalba [Mon, 21 Jun 2010 19:50:20 +0000 (20:50 +0100)]
Merge branch 'master' of free2.projectlocker.com:sf

10 years agoMoved a misplaced #endif in misc.cpp, which broke compilation in
Tord Romstad [Mon, 21 Jun 2010 09:25:06 +0000 (11:25 +0200)]
Moved a misplaced #endif in misc.cpp, which broke compilation in
Mac OS X.

No functional change.

10 years agoTest killer for legality earlier
Marco Costalba [Sat, 19 Jun 2010 15:48:36 +0000 (16:48 +0100)]
Test killer for legality earlier

Many killers moves, around 40%, are not legal, so
skip earlier in this case.

Some Movepicker c'tor cleanup while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoOptimize for king moves in see_sign()
Marco Costalba [Sat, 19 Jun 2010 14:44:03 +0000 (15:44 +0100)]
Optimize for king moves in see_sign()

Because we only test legal moves, a king move
cannot have negative SEE.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoMove prefetch() out of TT
Marco Costalba [Sat, 19 Jun 2010 10:10:54 +0000 (11:10 +0100)]
Move prefetch() out of TT

This code is platform specific and has nothing to
do with TT class, so move to misc.cpp

This patch is a prerequisite to use extend prefetch use
also to other hash tables apart from Transposition Table.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoExtend checks only if SEE is non-negative
Marco Costalba [Sat, 12 Jun 2010 13:47:30 +0000 (14:47 +0100)]
Extend checks only if SEE is non-negative

Idea from Dr. Hyatt

After 10k games at 5"+0 on my QUAD
Mod vs Orig +2750 =4601 -2649 +4 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoRevert "Use ply counter in Position object"
Marco Costalba [Sun, 13 Jun 2010 01:26:43 +0000 (02:26 +0100)]
Revert "Use ply counter in Position object"

Search ply and game ply are rwo different things !

Revert bogus commit.

No functional change on bench, but it changes in real games
when engine sends all the moves up to current one.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoSet LSNTime to 100 ms
Marco Costalba [Sat, 12 Jun 2010 09:29:50 +0000 (10:29 +0100)]
Set LSNTime to 100 ms

This is a timeout compatible with very short TC of 5 sec/game.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoRemove a wrong FIXME
Marco Costalba [Sat, 5 Jun 2010 17:04:58 +0000 (18:04 +0100)]
Remove a wrong FIXME

If we are there it means we already had that info stored in TT,
so we don't need to overwrite with the same content !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoAvoid a double copy when saving a TTEntry
Marco Costalba [Sat, 5 Jun 2010 09:50:24 +0000 (11:50 +0200)]
Avoid a double copy when saving a TTEntry

In statement:

*tte = TTEntry(posKey32, v, t, d, m, generation, statV, kingD);

We first create a TTEntry, then we copy the temporary entry to
its final destination in *tte then we discard the TTEntry.

Instead of this assign the fields directly to the destination TTEntry.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoAvoid calling evaluate() while razoring
Marco Costalba [Sat, 5 Jun 2010 07:40:47 +0000 (09:40 +0200)]
Avoid calling evaluate() while razoring

Micro optimization that gives a 0.5% speed improvment

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoOffset pv[] always from 0
Marco Costalba [Fri, 4 Jun 2010 07:46:38 +0000 (09:46 +0200)]
Offset pv[] always from 0

We don't need to offset from current ply.

Also rewritten a bit update_pv()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoBig qsearch() cleanup
Marco Costalba [Thu, 3 Jun 2010 17:29:48 +0000 (18:29 +0100)]
Big qsearch() cleanup

It is more clear and should be a bit faster too.

Reverted also previous optimization patch because
seems do not increase actual speed.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoExtend intermediate LMR to root search
Marco Costalba [Wed, 2 Jun 2010 10:47:53 +0000 (11:47 +0100)]
Extend intermediate LMR to root search

Almost no change, but it is in sync with what we do in search
and in any case the ELO difference is very small (because the
events when the intermediate research triggers are very rare),
too small to be measured, we just verify we don't have any
unexpected regressions.

After 802 games at 1+0 full QUAD
Mod vs Orig +114 =581 -107 +3 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoShortcut futility pruning in qsearch
Marco Costalba [Thu, 3 Jun 2010 10:10:12 +0000 (12:10 +0200)]
Shortcut futility pruning in qsearch

If we have pruned one capture due to its final value
we can prune also following ones because captures are
MVV ordered.

Also avoid a compare when not in PV because in that
case is always false.

No functional change.

10 years agoDo not pass threadID as argument of search() and evaluate()
Marco Costalba [Wed, 2 Jun 2010 19:37:18 +0000 (20:37 +0100)]
Do not pass threadID as argument of search() and evaluate()

Get it from the position instead.

A good semplification of function calling and a speedup too.

No functional change also with faked split.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoSave threadID info in Position
Marco Costalba [Wed, 2 Jun 2010 19:13:51 +0000 (20:13 +0100)]
Save threadID info in Position

This is the best place because when we split we do a
copy of the position and also threadID, once set in a
given position, never changes anymore.

Forbid use of Position's default and copy c'tor to avoid
nasty bugs in case a position is created without explicitly
setting the threadID.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoDon't initialize excludedMove and skipNullMove at each node
Marco Costalba [Wed, 2 Jun 2010 13:18:23 +0000 (14:18 +0100)]
Don't initialize excludedMove and skipNullMove at each node

Do it once at the beginning becuase they are always reset
after use in the calling place where are set.

No functional change also with faked split.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoUse SearchStack to pass allowNullmove
Marco Costalba [Wed, 2 Jun 2010 12:32:31 +0000 (13:32 +0100)]
Use SearchStack to pass allowNullmove

Also renamed allowNullmove in skipNullMove to reverse
the logic so that the field is initialized to 0 (false)
instead of 1 (true).

No functional change also with faked split.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoUse SearchStack to pass excludedMove
Marco Costalba [Wed, 2 Jun 2010 12:22:48 +0000 (13:22 +0100)]
Use SearchStack to pass excludedMove

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoFix white space breakage
Marco Costalba [Wed, 2 Jun 2010 10:25:02 +0000 (11:25 +0100)]
Fix white space breakage

No functional change with faked split.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoSync sp_search() with main search()
Marco Costalba [Wed, 2 Jun 2010 09:49:34 +0000 (10:49 +0100)]
Sync sp_search() with main search()

And fix qserahc() dispatch also there.

No functional change tested wit Faked Split.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoRetire bitScanReverse32()
Marco Costalba [Tue, 1 Jun 2010 20:28:45 +0000 (21:28 +0100)]
Retire bitScanReverse32()

Use log() instead because we are not in speed
critical paths.

Also a bit of renaming and code shuffle while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoRetire ok_to_do_nullmove()
Marco Costalba [Tue, 1 Jun 2010 18:49:46 +0000 (19:49 +0100)]
Retire ok_to_do_nullmove()

Has been remained the same from ages also with the FIXME.

Retire for now and rearrange the conditions order for
maximum performance.

Also a small touch at null zugzwang verification.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoMove invariant of singular ext. check out of loop
Marco Costalba [Tue, 1 Jun 2010 14:31:24 +0000 (15:31 +0100)]
Move invariant of singular ext. check out of loop

It is almost always false.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoRename ok_to_prune() in connected_threat()
Marco Costalba [Tue, 1 Jun 2010 14:02:14 +0000 (15:02 +0100)]
Rename ok_to_prune() in connected_threat()

It is more up to the point. Also small speedup
due to checking for threat move before calling
the function. This saves more then 90% of function calls.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoAvoid double function dispatch
Marco Costalba [Tue, 1 Jun 2010 12:03:46 +0000 (13:03 +0100)]
Avoid double function dispatch

In 44% of cases we call search() just to call
qsearch() one moment later, avoid this double dispatch.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoRetire init_node()
Marco Costalba [Tue, 1 Jun 2010 07:21:11 +0000 (08:21 +0100)]
Retire init_node()

Also don't poll in qsearch()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoDon't init SplitPointStack[i][j].parent
Marco Costalba [Tue, 1 Jun 2010 06:36:30 +0000 (07:36 +0100)]
Don't init SplitPointStack[i][j].parent

It is already set to zero because is allocated in
the global storage area.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoUse ply counter in Position object
Marco Costalba [Mon, 31 May 2010 20:38:34 +0000 (21:38 +0100)]
Use ply counter in Position object

And avoid a redundant one passed as argument in
search calls.

Also renamed gamePly in ply to better clarify this
is used as search ply and is set to zero at the
beginning of the search.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoFix SearchStack and ply misalignment in RootMoveList
Marco Costalba [Mon, 31 May 2010 17:32:00 +0000 (18:32 +0100)]
Fix SearchStack and ply misalignment in RootMoveList

In RootMoveList c'tor we call qsearch() with
ply == 1 but SearchStack at 0.

We never noticed before because in qsearch we don't access
previous's ply SearchStack, otherwise we would have got
a nice crash ;-)

This bug is a fall down of previous patch.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoConvert SearchStack ss[] to SearchStack*
Marco Costalba [Sun, 30 May 2010 07:56:38 +0000 (08:56 +0100)]
Convert SearchStack ss[] to SearchStack*

Use a pointer to current SearchStack to avoid ss[ply]
address calculation.

Gives 1% speedup on Intel compiler

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoAdd function to get ply from position
Marco Costalba [Mon, 31 May 2010 10:05:04 +0000 (12:05 +0200)]
Add function to get ply from position

It will be used by future patches.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoMove gamePly among the StateInfo data
Marco Costalba [Mon, 31 May 2010 09:47:15 +0000 (11:47 +0200)]
Move gamePly among the StateInfo data

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 years agoMove promotion and ep under pawn handling
Marco Costalba [Mon, 31 May 2010 11:01:33 +0000 (12:01 +0100)]
Move promotion and ep under pawn handling

And remove from main do_move() flow. Just a small speedup
because we avoid two branches in the common case.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>