1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 16:53:09 +00:00
Commit graph

605 commits

Author SHA1 Message Date
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
44b497a972 Re-fix square.h warning to avoid a compile error under MSVC
This fix adds ugliness to an already ugly previous fix...hopefully
it is the last one :-(

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-13 12:02:22 +01:00
Marco Costalba
b893583bb6 Fix a gcc warning due to order of initialization in Option
Move idx declaration before minValue and maxValue and silence
this last warning.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-13 12:02:14 +01:00
Marco Costalba
e81d0d08c3 Fix a compile error with Intel icc
To make std::sort() work operator<() should be
declared const.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-13 12:02:06 +01:00
Marco Costalba
72c7595f8a Fix a warning under Intel compiler in square.h
We need to cast to char the whole expression...

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-13 12:01:55 +01:00
Marco Costalba
e38ad4d42b Fix a very nasty conversion bug in Option c'tor
Sometimes C++ can be really bad!

In this case an hard coded c string selects Option c'tor
with int argument instead of the std::string one becuase
it is considered a better matching by the compiler.

Fix the bug changing the argument type from std::string to
const char* so to be a better match then the int one.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-12 01:10:50 +01:00
Marco Costalba
fad772f387 Store UCI options of type CHECK according to C++ convention
Store boolean values as "1" and "0" instead of "true" and "false"
and convert back to UCI protocol convention when needed.

This is simpler then the other way around.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-11 16:01:33 +01:00
Marco Costalba
ebb0f31928 Restore original UCI option printing order
For each option store its index so to be printed
according to insertion order.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-11 16:01:21 +01:00
Marco Costalba
f0701e2b0f Use a map instead of a vector to store UCI options
Apart from the teoretical speed increase, the main reason
of this patch is a good amount of code cleanup.

Note that now UCI options are printed in alphabetical
order and not in insertion order as before. Next patch
will take care of restoring old behaviour.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-04-11 16:01:08 +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
7b05b83bf2 Fix compile in the debug mode
Due to previous patches we end up with a compile
error in debug mode.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-31 20:50:24 +01:00
Marco Costalba
d7ef09727a Silence idiotic warning on two's complement of an unsigned
MSVC gives:

warning C4146: unary minus operator applied to unsigned type,
               result still unsigned

When finds -b where b is an unsigned integer. So rewrite the two's
complement in a way to avoid the warning. Theoretically the new
version is slower, but in practice changes nothing.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-31 20:50:10 +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
2c0cd95ecf An VALUE_TYPE_EVAL score cannot overwrite an entry
If we want to store a value of type VALUE_TYPE_EVAL for
a given position and we found an already exsisting entry
for the same position then we skip.

We don't want to overwrite a more valuable score with a
lesser one. Note that also in case the exsisting entry is
of VALUE_TYPE_EVAL type the overwrite is unuseful because
we would store the same score again.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-30 09:09:27 +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
c6c4713ab2 Document TTEntry and move layouts
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-30 08:29:02 +01:00
Marco Costalba
9e44a6dba9 A move needs 17 bits not 19
Fix a bug in the way a move is stored and read in a TT entry.
We use a mask of 19 bits insteaad of 17 so that the last
two bits in the TT entry end up to be random data.

This bug will bite us when we will use these two until now
unused bits.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-29 17:23:41 +01:00
Marco Costalba
941f4e1643 Remove some obsolete code in movepick.cpp
This fixes some warning under Intel compiler.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-27 19:35:08 +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
72af519e7f When asked for position key print it as an hex value
Merged from Glaurung current development snapshot.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-24 10:50:13 +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
d3f99aea6b Let zobrist keys to be compatible with Glaurung 1
Some changes to the zobrist keys, to make them identical
to those used by Glaurung 1.

The only purpose is to make it possible for both programs
to use the same opening book.

Merged from Glaurung current development snapshot.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-24 10:40:22 +01:00
Marco Costalba
0e835bd334 Fixed a sliding attack bitboard bug in 32-bit mode
This is what prevented USE_32BIT_ATTACKS from working
on some architectures (like PowerPC).

Merged from Glaurung current development snapshot.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-24 10:30:27 +01:00
Marco Costalba
43276cbec5 Fix a bug in insert_pv() where minimum depth is zero
We implicitly considered the minimum depth stored in TT
to be Depth(0), but because we store values in TT also in
qsearch() where depth is < 0, we need to use a negative
number as minimum depth.

Bug spotted by Joona Kiiski.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-23 15:30:20 +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
66d165921d Better castle move detector in move_to_san()
Merged from iPhone Glaurung.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-22 23:52:59 +01:00
Marco Costalba
b82c3021fa Fix a smal bug in Position::from_fen
We could fail to parse an en-passant position
in same cases.

Merged from iPhone Glaurung.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-22 23:52:23 +01:00
Marco Costalba
320630ca1a Merge new pawn storm evaluation
More accuracy in pawn storm evaluation
directly from iPhone Glaurung.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-22 23:52:06 +01:00
Marco Costalba
ef8acdc73b Fix a small bug in king safety
Merged from iPhone Glaurung.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-22 13:11:24 +01:00
Marco Costalba
cc8e915ed5 Merge KBPP vs KB endgame from iPhone Glaurung
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-22 13:06:29 +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
74160ac602 Big headers cleanup
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-19 12:55:32 +01:00