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

441 commits

Author SHA1 Message Date
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
Marco Costalba
feb5342b39 Safe guard some wild and ugly casts
These casts are needed but plain ugly, at least be
sure they don't hide any subtle conversion bug.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-16 13:59:41 +01:00
Marco Costalba
6cddf9183c Partially revert pawns storm bug fix
Try to save space and use the minimum size
possible.

In particular restore int16_t for values and int8_t
for halfOpenFiles.

Use int16_t for storm values insted of int and also
instead of original buggy and too small int8_t.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-16 08:02:33 +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
fcecc5212e Fix an overflow bug in pawns stormValue
These fields are defined as int8_t but values bigger
then 127 are stored there so that we silently overflow.

Fix bringing up all the fields to a sane int type. This
will increase memory usage, but apart from being safe, it is
not clear if code is slower or faster. Test is needed.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-15 18:18:56 +01:00
Marco Costalba
8de91be61e Fix a silly warning on Intel compiler
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-15 18:18:42 +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
3ed603cd64 Merge Joona Kiiski evaluation tweaks
Merge tewaks to many evaluation parameters
by Joona Kiiski.

After test they seem good!

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-14 12:55:14 +01:00
Marco Costalba
f637ddc1e8 Micro optimize move_is_check()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-07 21:05:49 +01:00
Marco Costalba
964bd86272 Micro optimize pl_move_is_legal()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-07 21:05:31 +01:00
Marco Costalba
72b88e09e1 Micro optimize previous patch
Also remove some Intel warnings, not all :-(

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-06 20:47:19 +01:00
Marco Costalba
3e663d8c50 Introduce evaluate_pieces<>() to remove redundancy
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-06 19:19:45 +01:00
Marco Costalba
8c9c51c721 Fix compile error with inlines under gcc and Intel
It seems that these compilers do not like inline functions
that call a template when template definition is not in scope.

So move functions from header to in *.cpp file

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-03-05 00:38:45 +01:00