1
0
Fork 0
Commit Graph

1625 Commits (61c727fdcbf676632371bb646aa69482096d371d)

Author SHA1 Message Date
Tord Romstad a1096e55cf Initial work towards adjustable playing strength.
Added the UCI_LimitStrength and the UCI_Elo options, with an Elo
range of 2100-2900. When UCI_LimitStrength is enabled, the number
of threads is set to 1, and the search speed is slowed down according
to the chosen Elo level.

Todo:

1. Implement Elo levels below 2100 by blundering on purpose and/or
   crippling the evaluation.
2. Automatically calibrate the maximum Elo by measuring the CPU speed
   during program initialization, perhaps by doing some bitboard
   computations and measuring the time taken.

No functional change when UCI_LimitStrength is false (the default).
2009-08-04 11:31:25 +02:00
Tord Romstad dad632ce5b Added LMR at the root.
After 2000 games at 1+0

Mod vs Orig +534 =1033 -433 52.525%  1050.5/2000  +18 ELO
2009-08-03 09:08:59 +02:00
Joona Kiiski 2f7723fd44 Remove useless mate value special handling in null search
After 1200 games (1CPU), time control 1+0:

Mod vs Orig: +331 =564 -277  +16 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-26 18:55:17 +01:00
Marco Costalba bdb586ac2b Micro optimize extension() in search.cpp
Small micro-optimization in this very
time critical function.

Use bitwise 'or' instead of logic 'or' to avoid branches
in the assembly and use the result to skip an handful of checks.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-25 16:48:28 +01:00
Marco Costalba 1cc44bcaae Correctly set mateThreat in search()
We do not accept null search returned mate values,
but we always do a full search in those cases.

So the variable mateThreat that is set only if null move
search returns a mate value is always false.

Restore the functionality of mateThreat moving the
assignement where it can be triggered.

After 999 games at 1+0

Mod vs Orig +253 =517 -229 51.20%  +8 ELO

Bug reported by xiaozhi

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-20 08:05:48 +01:00
Marco Costalba 15eb59683e Use increased LMR horizont also in PV search
Tord says that using a lower horizon at PV nodes
looks strange and inconsistent with the general
philosophy of our search (i.e. always being more
conservative at PV nodes). So set LMR at 3 also
on search_pv().

Test result after 601 games seems to confirm this.

Mod vs Orig +156 =318 -127 52.41%  315.0/601  +17 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-18 12:47:37 +02:00
Marco Costalba 620cfbb676 Reintroduce null move dynamic reduction
Test extension of LMR horizon to 3 plies alone, without
touching null move search. To keep the patch minimal we still
don't change LMR horizon in PV search. This will be the object
of the next patch.

Result seems good after 998 games:

Mod vs Orig  +252/=518/-228 51.20%  511.0/998 +8 ELO

So dynamic null move reduction seems a bit stronger then
fixed reduction even with LMR horizon set to 3.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-18 06:08:06 +01:00
Marco Costalba fe523b2d18 Use increased LMR horizont only after a null move
Revert to LMR horizont of 2 plies. Only if parent move
is a null move increase to 3 so to avoid the bad combination
of null move reduction + LMR reduction. This is a more
aggressive patch then previous one, but it seems we are
going in the wromg direction.

After 531 games result is not good:

Mod vs Orig  +123/=265/-143 48.12%  255.5/531  -13 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-18 06:08:02 +01:00
Marco Costalba 2a203d8d6f Combine increased LMR horizont and fixed null move reduction
Set null move reduction to R=4, but increase the LMR horizon
to 3 plies. The two tweaks are related and should compensate
the combined effect of null move + LMR reduction at shallow
depths.

Idea from Tord.

After 999 games at 1+0

Mod vs Orig  +251 =522 -225 51.30% + 9 ELO

On Tord iMac Core 2 Duo 2.8 GHz, one thread,
Mac OS X 10.6, at 1+0 time control we have:

Mod vs Orig 994-1006  -1.4 ELO

But Orig version is pgo compiled and Mod is not.
The PGO compiled version is about 8% faster, which
corresponds to about 7 Elo points. This means that
results are reasonably consistent.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-18 06:07:58 +01:00
Tord Romstad 342c8c883c Removed an incorrect assert() statement in search.cpp, which asserted that
a static eval cached in the transposition table would always equal the static
eval of the current position. This is in general not true, because the cached
value could be from a previous search with different evaluation parameter
settings, or from a search from the opposite side (Stockfish's evaluation
function is assymmetric by default).
2009-07-17 09:12:59 +02:00
Tord Romstad 5c20f59788 Renamed the variable 'looseOnTime' to 'loseOnTime', because I'm a pedant.
No functional change.
2009-07-15 11:01:49 +02:00
Marco Costalba ea06200423 Remove "Last seconds noise" filtering UCI option
This feature makes sense during development, but
It doesn't seem to make sense for normal users.

Also fix a possible race where the GUI adjudicates
the game a fraction of second before the engine sets
looseOnTime flag so that it will bogusly waits until
it ran out of time at the beginning of the next new game.

The fix is to always reset looseOnTime at the beginning
of a new game.

Race condition spotted by Tord.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-15 08:35:00 +01:00
Marco Costalba 2a461b4b74 Introduce see_sign() and use it to shortcut full see()
Mostly of times we are interested only in the sign of SEE,
namely if a capture is negative or not.

If the capturing piece is smaller then the captured one we
already know SEE cannot be negative and this information
is enough most of the times. And of course it is much
faster to detect then a full SEE.

Note that in case see_sign() is negative then the returned
value is exactly the see() value, this is very important,
especially for ordering capturing moves.

With this patch the calls to the costly see() are reduced
of almost 30%.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-12 08:37:43 +01:00
Marco Costalba 6f39a3fc80 Move some global variables to local scope in search.cpp
Some variables were global due to some old and now removed code,
but now can be moved in local scope.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-12 08:37:43 +01:00
Marco Costalba b45936a8c7 Revert per-thread history tables
Testing on Joona QUAD failed to give any
advantage. Actually we had a little loss:

Mod - Orig: 342.0 - 374.0

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-07-02 06:29:25 +01:00
Marco Costalba 36c0ab3a50 Fix compile errors in debug mode
Fall out of move_promotion() rename

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-20 19:18:00 +01:00
Marco Costalba 3a4d6e2034 Micro optimize and rename move_promotion()
Rename to move_is_promotion() to be more clear, also add
a new function move_promotion_piece() to get the
promotion piece type in the few places where is needed.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-20 09:04:32 +01:00
Joona Kiiski 8acb1d7e4d Disable use of aspiration window in known win positions
When we are hunting for mate, transposition table is filled in
with mate scores. Current implemenatation of aspiration search
can't cope with this very well.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-18 07:35:24 +01:00
Marco Costalba 630fda2e2c Reduce SMP contention on TT
Move TT object away from heavy write accessed NodesSincePoll
and also, inside TT isolate the heavy accessed writes variable.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-13 11:13:09 +01:00
Marco Costalba b5685fc564 Code style triviality in search.cpp
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-12 13:12:23 +02:00
Marco Costalba d2c2af9e1c Remove global variables from search.h
Globals are not really needed, so redefine as locals.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-12 13:10:40 +02:00
Marco Costalba 3e0753bef3 MovePicker doesn't need to know if called from a pv node
This was needed by an old optimization in sorting of
non-captures that is now obsoleted by new std::sort()
approach.

Remove also the unused depth member data. Interestingly
this has always been unused since the Glaurung days.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-12 13:10:02 +02:00
Marco Costalba 2f760cdf8d Document variables with heavy SMP read access
Also move NodesSincePoll away from the same cache line
of other heavy read accessed only variables.

Fortunatly we don't have anymore write access contention,
but still read access contention in some cases.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-03 17:36:50 +01:00
Marco Costalba b58ecb85c7 Retire UseQSearchFutilityPruning and UseFutilityPruning
They are always true anyway and are heavy used file scope
variables where there could be SMP contention. Although read only.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-03 17:35:56 +01:00
Marco Costalba b4a04d8038 Use one History table per thread
This reduces contention and reduce history trashing
effect especially at high search depths.

No functional change for single CPU case.

After 999 games at 1+0 on Dual Core Intel we have

Mod vs Orig  +233 =526 -240  -2 ELO

We need to test at longer time controls and possibly with
a QUAD where we could foreseen an improvment.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-03 17:34:35 +01:00
Marco Costalba c1b60269a2 Convert History table H in a local variable
This is a first step for future patches and in
any case seems a nice thing to do.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-02 09:57:15 +01:00
Marco Costalba e1ed67aacb Avoid using EmptySearchStack global
This reduces contention in SMP case and also
cleanups the code a bit.

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-06-02 09:35:49 +01:00
Marco Costalba a75aa6035b Move beta counter variables to the per-thread data
This should reduce concurrent accessing in SMP case.

Suggestion by Tord Romstad.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-16 12:25:35 +01:00
Marco Costalba 436fa5c8fa Better document how history works
Both with added comment and changing the API to
reflect that only destination square and moved piece
is important for history.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-16 12:06:54 +01:00
Marco Costalba 8df816f869 Fix broken multi-pv with aspiration window search
Aspiration window search must be disabled for
multi-pv case.

We missed one point where aspiration window should
be disabled in this case.

Patch from Joona, with a little added edit by me.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-15 17:48:18 +01:00
Marco Costalba 5c81602d14 Update copyright year
We are well in 2009 already.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-07 14:54:40 +02:00
Marco Costalba a88e762b4e Rewrite the way application exits
Centralize in a single object all the global resources
management and avoid a bunch of sparse exit() calls.

This is more reliable and clean and more stick to C++ coding
practices.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-07 12:59:19 +02:00
Marco Costalba 2155fb7825 Be sure book file is closed before we leave
Move closing of file in Book destructor. This
guarantees us against leaving the file open under
any case and simplifies also Book use.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-07 09:27:38 +02:00
Marco Costalba aabd526f7c Change TT interface to ask directly for a position key
Instead of a position because the key is all that we
need.

Interface is more clear and also very very little bit faster.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-05-03 08:11:36 +01:00
Marco Costalba 39f2eda285 Do not razor after a null move
We don't want to return unproven null move fails high, so
that if a position is so good that null move fails high we
want to check this with real do_move() / undo_move() test,
not just razoring the position because, from the opponent
point of view, is very bad.

These are tests results at 1+0

Mod vs Orig +252 -264 =483  49.40%
Mod vs Toga II 1.4.1SE  +365 -325 =309  52.00%

So it seems a very slightly regression regarding orig version (but
withing error bar) and a nice increase against Toga that is what we
are interested most. Orig version scores 49.75% against Toga, so
we welcome this change ;-)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-30 08:55:38 +02:00
Marco Costalba 00a3380885 Fix assignment of pv[0] when creating root move list
It is bogusly assigned from moves[i].move instead of mlist[i].move
or equivalently to moves[count].move that it seem more clear to me.

Bug is hidden while all the moves are included, in this default case
moves[i].move and mlist[i].move are the same variable.

Also a bit of cleanup while there.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-29 16:01:57 +02:00
Marco Costalba f1d982e2c0 Merge Joona's razoring tweaks
After proof testing on 3 different engines these
are the results:

Stockfish - Toga II 1.4.1SE +130 -132 =132 49.75%
Stockfish - Deep Sieng 3.0  +145 -110 =150 54.45%
Stockfish - HIARCS 12 MP    +94  -149 =150 43.00%

So it seems no regressions occurs, although also no
improvment. But anyhow this patch increases Stockfish
strenght against itself, so merge it.

Note that this patch not only adds back razoring at depth
one, but also increases razor depth limit from 3 to 4
because hard coded depth 4 limit is no more overwritten
by UCI parameter that otherwise defaults to 3.
2009-04-28 09:00:09 +02:00
Marco Costalba fbca16da57 Hardcode depth limit for selective search
Because futility margins array has a fixed size we cannot
arbitrarly choose or change the SelectiveDepth parameter,
otherwise we have a crash for values bigger then array size.

On the other hand tweaking of this parameter requires some
modification to the hardcoded margins, so makes sense to hard
code also this very bounded one.

Who wants to experiment is of course free to change the sources.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-28 08:47:26 +02:00
Marco Costalba 2f2e48fad2 Code style cleanup in transposition table code
Assorted fixes but no functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-27 13:21:49 +01:00
Marco Costalba 11491e71ee Remove an useless comparison in futility pruning
Currently futility is allowed when depth < SelectiveDepth
and SelectiveDepth is 7*OnePly, so the comprison is
always true.

Patch could introduce a functional change only if
we choose to increase SelectiveDepth.

Currently no functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-27 09:45:15 +01:00
Marco Costalba bd26374f21 Small code tidy up and test results
When testing at 1'+0" time control results are still
reasonably good. We have made two sessions on two
different PC.

After 840 games Mod - Orig: +221 -194 =425 +10 ELO (two CPU)

After 935 games Mod - Orig: +246 -222 =467  +9 ELO (single CPU)

So it seems that with fast CPU and/or longer time controls
benefits of the patch are a bit reduced. This could be due
to the fact that only 3% of nodes are pruned by razoring at
depth one and these nodes are very swallow ones, mostly get
pruned anyway with only a slightly additional cost, even
without performing any do_move() call.

Another reason is that sometime (0,3%% of cases) a possible
good move is missed typically in positions when moving side
gives check, as example in the following one

3r2k1/pbpp1nbp/1p6/3P3q/6RP/1P4P1/P4Pb1/3Q2K1 w - -

The winning move Rxg7+ is missed.

Bottom line is that patch seems good for blitz times, perhaps
also for longer times. We should test against a third engine
(Toga ?) to have a final answer regarding this new setup.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-26 13:51:54 +01:00
Joona Kiiski d20e0cf048 Razor again at depth one
Some time ago it was found by Marco Costalba that it's better
to disable razoring at depth one, because given the very low
evaluation of the node, futility pruning would already do
the job at very low cost and avoiding missing important moves.

Now enable razoring there again, but only when our quickly evaluated
material advantage is more than a rook. The idea is to try razoring
only when it's extremely likely that it will succeed.

Extreme lightning speed test show promising result:
Orig - Mod: +1285 =1495 -1348

This needs to be tested with longer time controls though.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-26 13:51:50 +01:00
Joona Kiiski 342ceb1c91 Make futility and razor margins more tunable
Restructure RazorMargins and FutilityMargins arrays so that their
values can be more easily tuned.

Add RazorApprMargins array which replaces razorAtDepthOne concept,
because setting RazorApprMargin very high value at ply one is
same as not razoring there at all.

Comment out setting razoring and futility margins through uci to
avoid errors while tuning.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-26 13:51:47 +01:00
Marco Costalba f010b6db71 Do not hardcode default values of UCI variables
If a variable will be populated reading an UCI option
then do not hard code its default values.

This avoids misleadings when reading the sources.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-26 13:41:17 +01:00
Joona Kiiski f98385e129 Add missing header file to make stockfish compile with latest Inter C++ Compiler under Linux (memcpy needs cstring)
Correct some references glaurung -> stockfish in Makefile

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-19 20:57:23 +01:00
Marco Costalba e68ebe618c In qsearch store the cut move in TT
And upon reentering the same position try it as first.

Normally qsearch moves order is already very good, first move
is the cut off in almost 90% of cases. With this patch, we get
a cut off on TT move of 98%.

Another good side effect is that we don't generate captures
and/or checks when we already have a TT move.

Unfortunatly we found a TT move only in 1% of cases. So real
impact of this patch is relatively low.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-18 14:04:00 +01:00
Marco Costalba e30720b0bf Remove failHigh/Low bits from IterationInfoType
We don't use that info anyway.

Also document a little more new aspiration window code.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-18 09:12:41 +01:00
Joona Kiiski 7af1b40b4e Restore calling insert_pv after search is aborted + small clean-up
Restore old behaviour that after search is aborted we call insert_pv,
before breaking out from the iterative deepening loop.

Remove one useless FIXME and document other better.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-18 09:12:18 +01:00
Marco Costalba ecec7dbf89 Little code style tweaks
Let the code be more conformant to current style.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-18 09:12:07 +01:00
Marco Costalba 8da2153ee8 Revert previous patch as per Joona request
Joona says patch gives bad results after testing,
so revert for now.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-18 09:11:56 +01:00
Joona Kiiski 22f9f0cabe Improve handling of fail-highs in assumed PV
Check all fail highs in assumed PV with greater care (fruit/Toga already does this).
Add a flag when aspiration search fails high at ply 1 to prevent search to
be terminated prematurely.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-18 09:11:41 +01:00
Joona Kiiski 3e7e1a7c53 Revert "Implement a fallback system when aspiration search fails low and we are out of time."
This reverts commit 55dd98f7c717b94a659931cd20e088334b1cf7a6.

Revert fallback-system for root_search

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-18 09:11:30 +01:00
Joona Kiiski 0ea716463b Implement a fallback system when aspiration search fails low and we are out of time.
However also this patch is immediately reverted. For three reasons:
1) the case it affects is very rare (and then we are likely to lose anyway),
   so we can well live without this.

2) Because the case is so rare it's hard to test this change properly.

3) To perform fallback search, we must reset so many global variables that this
   patch is very likely both buggy and extremely bad style.

Consider including this again if we clean-up global variables one day...

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-18 09:11:15 +01:00
Joona Kiiski 6c4e36aab6 Revert "Implement bestValue in root_search."
This reverts commit 9a39f93f35254787b7b57980019dde276a89c48c.

Revert bestValue in root_search

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-18 09:11:05 +01:00
Joona Kiiski 6f28bcd483 Implement bestValue in root_search.
However just after finished writing this patch I realized that this
is not the way to go. So this will be immediately reverted.

(Just save this here in git in case I change my mind later :) )

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-18 09:10:54 +01:00
Joona Kiiski acef5d6a59 Dynamic aspiration search without research.
Implement system where aspiration search window is calculated using
values from previous iterations.

And then some crazy experimental stuff: If search fails low at the root,
don't widen window, but continue and hope we will find a better move
with given window. If search fails high at the root, cut immediately,
add some more time and start new iteration.

Note: this patch is not complete implementation, but a first test
for this idea. There are many FIXMEs left around. Most importantly
how to deal with the situation when we don't have any move!

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-18 09:10:41 +01:00
Marco Costalba 95aadb5e53 Remove unused currentMoveCaptureValue from search stack
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-11 11:09:37 +01:00
Marco Costalba 17ef886fc3 Less aggressive null move dynamic reduction
In null move search do not jump directly in
qsearch() from depth(4*OnePly), but only
from depth(3*OnePly).

After 999 games at 1+0: +248 -224 =527 +8ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-11 10:58:10 +01:00
Marco Costalba 8590a6f3b7 Revert dynamic LMR
It doesn't seem to work against Toga. After more then 400 games
we are at -13 ELO while, without it we are at + 5 ELO after 1000
games.

So revert for now to keep code simple.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-03 20:34:22 +01:00
Marco Costalba 683595fee1 Silence a bunch of warnings under MSVC /W4
Still some remain, but are really the silly ones.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-31 20:49:56 +01:00
Marco Costalba 659c54582d Revert setting a flag when TT value equals static evaluation
Strangely enough it seems that optimization doesn't work.

After 760 games at 1+0: +155 -184 =421 -13 ELO

Probably the overhead, although small, for setting the flag
is not compensated by the saved evaluation call.

This could be due to the fact that after a TT value is stored,
if and when we hit the position again the stored TT value is
actually used as a cut-off so that we don't need to go on
with another search and evaluation is avoided in any case.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-31 20:41:06 +01:00
Marco Costalba 6a8e46d53e Remember when TT value equals static evaluation value
When the stored TT value equals the static value set a
proper flag so to not call evaluation() if we hit the
same position again but use the stored TT value instead.

This is another trick to avoid calling costly evaluation()
in qsearch.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-30 08:54:09 +01:00
Marco Costalba dcdac83187 Revert storing of TT when returning from "stand pat"
After testing it seems patch is bad:

After 999 games 1+0: +242 -271 =486 -10 ELO

So restore saving of TT at the end but using new Joona
idea of storing as VALUE_TYPE_UPPER/VALUE_TYPE_LOWER instead
of VALUE_TYPE_EXACT.

Some optimization is still possible but better test new ideas
one by one.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-27 15:30:45 +01:00
Marco Costalba 5a0581498c Cache evaluation score in qsearch
Instead of just drop evaluation score after stand pat
logic save it in TT so to be reused if the same position
occurs again.

Note that we NEVER use the cached value apart to avoid an
evaluation call, in particulary we never return to caller
after a succesful tt hit.

To accomodate this a new value type VALUE_TYPE_EVAL has been
introduced so that ok_to_use_TT() always returns false.

With this patch we cut about 15% of total evaluation calls.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-24 18:28:42 +01:00
Marco Costalba 1c087dd806 Let to toggle dynamic LMR
It is now disabled by default due to bad results
against a pool of engines...more testing is needed tough.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-24 18:28:25 +01:00
Marco Costalba 095a96b461 In qsearch update TT only if returning from stand pat
This is the only "correct" exact value we can store.

Otherwise there could be spurious failed high/low nodes.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-24 11:26:43 +01:00
Marco Costalba db46602b1f Wait at least until iteration 3 before to stop the search
It was 2 before.

Merged from Glaurung current development snapshot.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-24 10:49:02 +01:00
Marco Costalba a9e55d4326 Revert odd depths razoring
I have just made a new rule that no modification
that increases pruning is allowed if after 1000 games
ELO is not increased by at least 10 point (was +5 in this case)

Yes, I like this kind of nosense rules :-)
2009-03-23 12:02:15 +01:00
Marco Costalba 4d70e3aeac More aggressive dynamic LMR
Previous setup didn't change anything

After 996 games 1+0: +267 -261 =468 +2 ELO

Now with this new setup we have

After 999 games 1+0: +277 -245 =477 +11 ELO

Seems reasonable...

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-23 11:58:28 +01:00
Marco Costalba 24b7ad54c7 LMR dynamic reduction
Reduce of two plies near the leafs and when we still
have enough depth to go so to limit horizon effects.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-22 23:53:22 +01:00
Marco Costalba 0ff3bf34cd Always print a best move when requested
Little fix merged from iPhone Glaurung.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-22 23:53:10 +01:00
Marco Costalba 16abc165d8 Fix: In qsearch do not use TT value when in a PV node
We already do like this in search_pv(), so extend
also in qsearch().

Bug spotted by Joona Kiiski.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-21 14:51:31 +01:00
Marco Costalba b870f5a091 Silence a good bunch of Intel warnings
Note that some pawns and material info has been switched
to int from int8_t.

This is a waste of space but it is not clear if we have a
faster or slower code (or nothing changed), some test should be
needed.

Few warnings still are alive.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-15 18:19:08 +01:00
Marco Costalba ca4e78db8d Revert NULL move beta corrections
After testing result is bad -25 ELO
2009-03-15 16:44:12 +01:00
Marco Costalba bfcfaf7101 Retire Null Driven IID
It does not seem to clearly improve things and
in any case is disabled by default, so retire for now.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-15 16:43:28 +01:00
Marco Costalba c8773c720a Merge Joona Kiiski NULL search beta correction
Prune more moves after a null search because of
a lower beta limit then in main search.

In test positions reduces the searched nodes of 30% !!!!

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-14 13:00:22 +01:00
Marco Costalba 02cd96e4c2 Cleanup SearchStack initialization
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-03 21:01:00 +01:00
Marco Costalba c02613860a Revert hidden checkers rework
It is slower the previous uglier but faster code.

So completely restore old one for now :-(

Just leave in the rework of status backup/restore in do_move().

We will cherry pick bits of previous work once we are sure
we have fixed the performance regression.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-02 16:20:00 +01:00
Marco Costalba 8f59de48f5 Introduce StateInfo instead of UndoInfo
We don't backup anymore but use the renamed StateInfo
argument passed in do_move() to store the new position
state when doing a move.

Backup is now just revert to previous StateInfo that we know
because we store a pointer to it.
Note that now backing store is up to the caller, Position is
stateless in that regard, state is accessed through a pointer.

This patch will let us remove all the backup/restore copying,
just a pointer switch is now necessary.

Note that do_null_move() still uses StateInfo as backup.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-22 21:18:50 +01:00
Marco Costalba 2f21ec39ad Convert also undo_null_move() to avoid passing UndoInfo object
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-22 21:18:14 +01:00
Marco Costalba 9b257ba29d Passing UndoInfo is not needed anymore when undoing the move
We store it now in the same UndoInfo struct as 'previous'
field, so when doing a move we also know where to get
the previous info when undoing the back the move.

This is needed for future patches and is a nice cleanup anyway.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-22 21:18:02 +01:00
Marco Costalba 9e1d142fdd Finally remove any occurence of dcCandidates from search.cpp
This ends our cleanup series.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-19 17:35:23 +01:00
Marco Costalba 683e6dc656 Do not pass discovery check candidates in Position::do_move()
Also remove any bit of 'pinned' and co. from MovePicker class.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-19 17:29:36 +01:00
Marco Costalba c6630abe0d Do not pass pinned argument in Position::move_is_check()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-19 17:01:08 +01:00
Marco Costalba 7013efce4e Change piece_attacks_square() API
An extra argument let us simplify some code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-17 12:00:05 +01:00
Marco Costalba f32992f88c Avoid a call to move_is_capture() in extension()
Pass value as an argument instead or recalculating it.
Altough call is cheap this is a very hot path so with
this patch total time spent for move_is_capture() is almost
halved.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-13 20:57:03 +01:00
Marco Costalba dc4e2d8184 Take in account odd depths in razoring formula
This is somewhat taken from Stockfish 1.2 Default,
only the razoring thresold are updated, not the
razoring depth.

At the end razoring is a bit more aggressive. Results
seems slightly positive.

After 999 games +239 =536 -224 Elo +5

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-01-05 12:41:27 +01:00
Marco Costalba cc3c1dc25a Stockfish 1.2 optimistic
Optimistic razoring settings. It is stronger with
most engines but weaker with someones.

The default is instead more solid and uniform with all
the opponents.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-29 12:24:34 +01:00
Marco Costalba d99a95df29 Micro optimization in extension()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-29 12:18:36 +01:00
Marco Costalba 0da1d6a846 Remove a gcc warning on an unused variable
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-29 12:18:23 +01:00
Marco Costalba 5d94305af3 Properly handle odd depths in razor formula
A little bit more aggressive, but should be more
in line with the depths logic.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-28 19:38:44 +01:00
Marco Costalba e4fd9a2df7 Safer razoring formula
Add also the possibility to razor at ply one.
It is disable dby default but it seems stronger
against Stockfish itself. It is still not clear if
is stronger against other engines. By now leave
disabled.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-28 12:55:33 +01:00
Marco Costalba dae4e7df07 Tweak again futility margings
Lower margins near the leafs, higher at high depth.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-25 20:08:45 +01:00
Marco Costalba 96a32eec69 Expose new futility margin interface to UCI
Now futility margin it's actually a scale factor
to apply to the base ones.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-25 19:41:24 +01:00
Marco Costalba e46d3670fd Tweak futility margins
Less prune at the bottom and at the middle, a bit more
at the top.

After 747 games: +215 =345 -187 +13 elo

Also introduced a vector of margins, now that start to be a lot
it is a more flexible solution.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-25 12:05:45 +01:00
Marco Costalba 8cd5cb930d Try razoring only for depth > OnePly
Because razoring verification after qsearch() cuts more
then 40% of candidates, do not waste a costly qsearch for
nodes at depth one that will be probably discarded anyway
by futility.

Also tight razoring conditions to keep dangerous false
negatives below 0,05%. Still not clear if it is enough.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-24 09:35:57 +01:00
Marco Costalba 2feb9d5100 Futility pruning till ply 6 included
Seems good:

After 796 games: +211 = 393 -192 +8 elo

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-24 09:34:09 +01:00
Marco Costalba d11426c777 Fix a comment
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-23 12:02:10 +01:00
Marco Costalba e96f56adfa Merge futility pruning from Glaurung 2.2
It seems much more powerful then previous one.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-23 12:01:48 +01:00
Marco Costalba 3fafc9768a Set the 'Problem' variable only at ply == 1
Bug fix merged from Glaurung 2.2 for search_pv()

Added the same fix also to sp_search_pv() where
was missing.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-22 11:44:00 +01:00
Marco Costalba 23490bd825 Retire EvaluatePawnStorms and UseEasyMove constants
Merged from Glaurung 2.2

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-21 20:10:20 +01:00
Marco Costalba 72ca727b38 SEE: add support for enpassant moves
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-21 10:44:41 +01:00
Marco Costalba 2d0146fe1d Call poll() before to check for stopped search
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-21 10:44:12 +01:00
Marco Costalba 96d0501735 Less aggressive razoring
Use a margin to compare with beta so that positions
that after the verifying qsearch have gained a lot of points
are not discarded just becasue not above beta.

Also remove the second condition on depth <= OnePly, it
was too risky and added only a 2% more of pruned nodes.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-21 10:42:39 +01:00
Marco Costalba b58ad355ca Revert: "Do not razor when in check"
It is slightly weaker after 500 games. Keep the
check on mate values.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-18 22:01:56 +01:00
Marco Costalba 17000d1ea0 Trigger of PawnEndgameExtension if capture is not a pawn
Instead of a rook.

This gives an unexpected graeat increase!

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-17 19:36:51 +01:00
Marco Costalba b09cbaebb9 search_pv: an enpassant move is a capture
Fix the logic in search_pv and sp_search_pv

An additional issue to consider is that a castle move
is not a capture but destination square is not empty.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-16 22:20:53 +01:00
Marco Costalba 725c504a5f qsearch: take in account enpassant in futility formula
Should not change anything at ELO level but it is
the correct thing to do.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-16 22:20:42 +01:00
Marco Costalba bfbfc24d07 qsearch: do not call evaluate when in check
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-16 22:20:18 +01:00
Marco Costalba ecc19381b4 Do not razor while in check or value is mate
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-15 22:20:03 +01:00
Marco Costalba dae2f600d6 Do not null search when beta is a mate value
Also do not return unproven mates in null search.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-15 22:19:25 +01:00
Marco Costalba 4c294932e7 Better document null move dynamic reduction
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-15 22:18:56 +01:00
Marco Costalba c831b00544 Introduce beta counters to order moves at ply one
Instead of number of searched nodes use the number of
opponent beta-cutoff occurred under the move subtree.

After 570 games 1+0 we have: +150 =288 -132 (+11 ELO)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-15 22:13:42 +01:00
Marco Costalba 5b853c9be6 Debugging: move debug function definitions in misc.cpp
Also activate writing on log file.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-14 17:26:05 +01:00
Marco Costalba 8ee3124487 Fix two bugs in ok_to_prune() (2)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-12 22:27:43 +01:00
Marco Costalba 07b45151d2 Disable "Null driven IID" by default
Testing is not clear. Probably we need to test
at deeper depths to have some clear results.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-11 20:39:08 +01:00
Marco Costalba 9e3ab9099f Null move only for depth > OnePly
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-11 20:38:52 +01:00
Marco Costalba f09884d72f Null driven IID: remove IIDMargin from see() condition
This seems to cut searched nodes also more.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-10 21:43:09 +01:00
Marco Costalba 8d86c87e1e Add "Null driven IID" UCI option (default true)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-08 10:57:40 +01:00
Marco Costalba c172af1b61 Null move driven internal iterative deepening
When a null move fails low due to a capture, try
to detect if without the capture we are above beta,
in this case there is a good possibility this is
a cut-node and the capture is just a null move
artifact due to side to move change. So if we still
don't have a TT move it's a good time to start an IID.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-08 10:46:52 +01:00
Marco Costalba b4fcfed55b Null capture pruning
Null move can fail low because of a capture artifact due
to the side to move change. Try to detect this condition
and fail high instead.

This pruning is very powerful, around 7% of nodes, but is
still experimental so is disabled by default.

Set UseNullCapturePruning to true to enable.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-06 11:31:14 +01:00
Marco Costalba d95b9189d8 Revert opponent time advantage logic
Strength increase was due to an hidden bug introduced
by the patch, namely the time per move to /30 instead
of /40 (see previous patch).

After testing this feature do not add any substantial
increase so is removed.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-30 19:23:33 +01:00
Marco Costalba 20a2ca366f Tweak allocated time per move
It seems better to give more time in middle game then
at the end.

Also Toga uses the same limit.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-25 20:41:06 +01:00
Marco Costalba c3ba5fb9d3 Rewrok the extendeable patch
Cleanup and document.

The real functional change is that not mate threat
moves are never pruned, as could happen before.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-25 20:40:49 +01:00
Marco Costalba ee9f650242 Use extendable instead of depth extension
We can have depth(0) also in problematic cases
according to how extensions are tweaked by the user.

In any case we don't want to prune these moves.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-25 20:40:12 +01:00
Marco Costalba 1867785231 Introduce depth limited benchmarking
Also print some more info.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-22 11:02:05 +01:00
Marco Costalba 1d525bb45f qsearch: restore pruning of pv nodes with negative SEE
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Signed-off-by: unknown <Marco@.(none)>
2008-11-19 22:15:14 +01:00
Marco Costalba da7d872eda Fix Intel warnings and init_search_stack argument
Should be a reference not a copy!

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-16 12:46:12 +01:00
Marco Costalba 7daaf03b39 Add and use update_killers()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-16 12:37:48 +01:00
Marco Costalba 2e778445d5 Add and use move_is_killer() helper
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-16 12:37:48 +01:00
Marco Costalba 93bc05cf69 Convert killers to a vector
Add infrastructure to threat killer moves as a vector,
this will allow us to easily parametrize the number of
killer moves, instead of hardcode this value to two as is now.

This patch just add the infrastructure, no functional
change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-16 12:37:47 +01:00
Marco Costalba a7227ac26f qsearch: do not prune pv nodes with negative SEE
Also small micro-optimization, take a line out of
the moves loop.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-16 12:37:47 +01:00
Marco Costalba 20d7197a9b MovePicker: use EvalInfo to skip generating captures
When we know already no captures are possible in a given
position.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-16 12:37:46 +01:00
Marco Costalba 2d4e2bc62a Fix in ok_to_history(): castle move is not a capture
It is erroneusly considered a capture because king
moves on the same square of the rook.

Use the correct function Position::move_is_capture()
instead of the open coded (and buggy) one.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-10 19:19:40 +01:00
Marco Costalba cdf1f23bc5 Micro optimization of update_history()
Remove an useless comparison.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-10 19:19:40 +01:00
Marco Costalba e86468cc63 Use cut-off checks in qsearch as killer moves
Killers should not be captures, but checks are not
and are produced also in qsearch.

Use this information, will be useful for move ordering.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-10 19:19:40 +01:00
Marco Costalba e7bad2687a Smaller null move reduction when depth is high
Lower probability to miss something important.

It seems to increase strenght. Idea form Cyclone.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-10 19:19:39 +01:00
Marco Costalba 3f610e2b13 Introduce LastIterations variable
Is set during the last iteration.

Sometime also during the second last.

During the last iteration is set in the 95% of cases.

During the second last is set in the 40% of cases.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-10 19:19:39 +01:00
Marco Costalba 8097e99c69 Stockfish 1.0
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-02 15:35:32 +01:00
Marco Costalba 55b6464d40 search: micro optimization
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-02 15:00:28 +01:00
Marco Costalba 6e5cf2f3c5 Revert "Relax time constraints"
Does not seem to give an improvment, acutually it seems
a totally neutral change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-01 12:46:53 +01:00
Marco Costalba e5ebd4f5d1 Partially space inflate search.cpp
Space inflate main remaining functions in search.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-01 12:46:53 +01:00
Marco Costalba cf2bafb661 Relax time constraints
Allow a seacrh to take a bit more time if needed.

This reduces the chanches of wast all the search time
for the last iteration and also allow to start the last
iteration when we have less time remaining.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-01 12:46:53 +01:00
Marco Costalba 7d717df4e4 Revert "Last minute surprise" for now
It defenitly needs more testing. Just postponed.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-01 12:46:52 +01:00
Marco Costalba 74fd57220e Refine "few moves" in "last minute surprise"
It seems that "few moves" works because we extend the good
captures at the last ply of PV, so code it directly.

This version seems defenitly stronger then previous one.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-01 12:46:51 +01:00
Marco Costalba 0936a96a0e Space inflate extension() code
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-26 21:30:21 +01:00
Marco Costalba 13d1776a98 TEST: extend when few moves available
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-26 21:30:21 +01:00
Marco Costalba 5dc2312121 Update copyright info
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:20 +02:00
Marco Costalba d8268024a9 Implement Last Seconds Noise (LSN) filtering
When an engine is in deep trouble at few
seconds from time limit then giveup without
fighting anymore.

This is used to reduce "lucky draws" and time pressure
blunders noises that can obfuscate results during tests
blitz games (typical one minute games).

Goal of this technique is to reduce number of matches
needed to reliably prove then an engine A is stronger
then an opponent B.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-13 20:40:48 +02:00
Marco Costalba 4fa5dd4db5 Add a second margin to razoring
Razor on ply one if the advantage is more then a pawn,
the only way to gap the advantage is to capture, so
go directly in quiesce.

This seems to have a positive effect.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-13 20:40:47 +02:00
Marco Costalba a6017aa728 Add mean calculation in debug tools
Another simple performance counter...

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-11 19:25:16 +02:00
Marco Costalba 6a15df1d82 Revert bad capture pruning
After testing does not seem to increase ELO.

Indeed Glaurung is a little bit weaker, so revert.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-11 19:03:59 +02:00
Marco Costalba bbf7a94d76 Better interface to get the current move type
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-06 05:44:23 +02:00
Marco Costalba a3477af2a1 Allow to prune bad captures
Only good capture are preserved from futility pruning
and LMR reducing.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-06 05:44:23 +02:00
Marco Costalba 7dd0c39714 Warnings termination fest
A bunch of Intel C++ warnings removed, other silent out.

Still few remaining but need deeper look.

Also usual whitespace crap removal noise.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 00:32:53 +02:00
Marco Costalba 060eef4f4e Do not use evaluate() for razoring
Because razoring is reached 10% of times and about 50% of time
first two conditions are met we can save 5% of calls to the fairly
costly evaluate().

On the other side statistics have shown 95% of nodes that pass
the first two razoring conditions pass also the evaluate() test.
So the risk of dropping the third condition seems low enough.

Testing seems to validate this.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-23 23:36:51 +02:00
Marco Costalba 2dbc8feae3 Finally remove last old C style I/O stuff
Now I/O is fully done with C++ iostreams.

The only exception is in non-windows version
of Bioskey() in misc.cpp

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-20 06:53:06 +02:00
Marco Costalba 5c4f6f6226 Cleanup poll()
Reshape this function in preparation
for future work.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:27:09 +02:00
Marco Costalba 18860cce40 Improve time managment
If we need some more and we are in time
advantage take it.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:27:09 +02:00
Marco Costalba d583176baf Pass also opponent time to think()
This patch modifies think() signature to accept
also opponent time. This is needed for future
changes to time managment.

Still no functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:27:09 +02:00
Marco Costalba 5080e72ea5 Prefer strncpy() to strcpy()
This removes a warning under MSVC++

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:25:55 +02:00
Marco Costalba 295352d04a Fix: "Ponder" option has type bool not int
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:25:22 +02:00
Marco Costalba 421fd9c3bf Space inflate sp_search_pv
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-09 11:37:27 +02:00
Marco Costalba eacb42092b Space inflate sp_search
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-09 11:15:58 +02:00
Marco Costalba a10c9632a5 Use TT in qsearch
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-09 07:37:46 +02:00
Marco Costalba bc4e937f05 search: fix a bug and clear history update
When a move produces a beta-cut off is marked as
success in history and all the remaining ones are
marked as failures.

The loop across the searched moves, that is used
to register failures, does not skip the good one,
that is then registered as a failure too.

The patch fixes the bug and cleanup the code.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-07 09:38:19 +02:00
Marco Costalba 6c592955e1 Space inflate qsearch
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-07 08:31:30 +02:00
Marco Costalba d517080ab6 Space inflate search()
Same as previous patch but for search() function.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-06 18:25:58 +02:00
Marco Costalba b7781e8faa search_pv: spaces inflate
It seems easier to understand, at least to me.

Hopefully no functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-06 17:12:39 +02:00
Marco Costalba a230dc1404 Split transposition table lookup in a separate function
This slims down the code and is a prerequisite for
future patches.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-06 15:53:43 +02:00
Marco Costalba dad9a1eca7 RootMoveList: inline trivial accessors
Although not performance critical, trivial
accessors can be inlined without any harm.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-06 06:37:00 +02:00
Marco Costalba 731a9f3806 RootMoveList sorting: be compatible with std::sort
sort() and sort_multipv() are almost the same, so
use only one implementation.

Also introduce the natural RootMove::operator<() to
compare the moves instead of compare_root_moves(),
this will allow to use std::sort instead of our
home grown bubble-sort.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-05 09:04:45 +02:00
Marco Costalba bd3fd6501b scan_for_easy_move: we don't need a loop here
Moves are already sorted, so just consider the best
and the second one.

Some trailing whitespace remove noise crept in due
to my editor removes it before to save.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-03 23:33:49 +02:00
Marco Costalba 9ec12da028 Better document RootMoveList c'tor
Also some code tidy-up.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-03 23:29:04 +02:00
Marco Costalba bb751d6c89 Initial import of Glaurung 2.1 2008-09-01 07:59:13 +02:00