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

3431 commits

Author SHA1 Message Date
Marco Costalba
62f531254e Fix comments in thread.cpp
And reshuffle a bit the functions to place
them in a consistent order.

To be on the safe side, patch has been
validated for no regression/crashes with
a small 8K games test with 3 threads:

ELO: 3.98 +-4.4 (95%) LOS: 96.3%
Total: 8388 W: 1500 L: 1404 D: 5484

No functional change.
2015-01-03 09:34:58 +01:00
Marco Costalba
91cc82aa25 Let material probing to access per-thread table
It is up to material (and pawn) table look up
code to know where the per-thread tables are,
so change API to reflect this.

Also some comment fixing while there

No functional change.
2015-01-02 21:31:02 +01:00
Matthew Lai
19b8249ff4 Disable the default copy constructor for Position class
No functional change

Resolved #183
2015-01-02 20:19:11 +00:00
Stefan Geschwentner
25b492ab58 Big King Safety tuning
All king safety related terms (shelterweakness, stormdanger,
attackunits, ..) was tuned together. Additionally for attack units a
finer granularity (factor 4) is used.

STC
ELO: 9.22 +-3.1 (95%) LOS: 100.0%
Total: 19514 W: 4340 L: 3822 D: 11352

LTC
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 6399 W: 1192 L: 1056 D: 4151

Bench: 8224782

Resolves #184
2015-01-03 03:33:02 +08:00
Marco Costalba
4c9b423161 Retire Material::space_weight()
Move all in evaluation.

Simplify the code and concentrate in a single place
all the logic behind space evaluation, making it much
more clear.

Verified also at STC it does not regress due to a possible
slow down:

LLR: 3.91 (-2.94,2.94) [-3.00,1.00]
Total: 65744 W: 13285 L: 13194 D: 39265

No functional change.
2015-01-02 10:02:28 +01:00
Marco Costalba
2416242c96 Additional tidy up in timeman.cpp
Fixed some comments and moved/renamed some
variables.

No functional change.
2014-12-30 09:49:54 +01:00
Marco Costalba
6933f05f4b Use score and value consistently
And other assorted small fixing, code style
tweaks and reshuffles in evaluate.cpp

No functional change.
2014-12-28 19:06:56 +01:00
Arjun Temurnikar
f9571e8d57 Remove some comments in timeman.cpp
Commenst are obsolete now, an updated description
would be quite obscure, so better let the code
to talk and remove them all together.

No functional change.
2014-12-28 11:58:29 +01:00
Marco Costalba
2bfacf136c Reformat promotion generation
Use the same template of other pawns moves generation,
make the code more uniform, simplify generate_promotions
that has now been renamed.

No functional change (verified also with perft).
2014-12-25 11:09:07 +01:00
Marco Costalba
296534f234 Prefer names to numbers in storm code
Also replaces some tabs with spaces and
change StormDanger order to reflect
ShelterWeakness one.

No functional change.
2014-12-22 08:33:07 +01:00
Joona Kiiski
e5c7b44f7a Use "rm -f" instead of "rm" for gcc profiling hack in Makefile
In some UNIX systems "rm" prompts user for confirmation.
However "rm -f" is always a guaranteed forced deletion.

Also move gcc profiling hack under the correct target

No Functional change

Resolves #168
2014-12-20 17:55:18 +00:00
Stefan Geschwentner
3231038262 Big King Safety tuning
ShelterWeakness and Stormdanger array are now indexed additionally by
file pair (a/h,b/g,c/f,d/e). The special case of king blocking a pawn
is incorporated in the StormDanger array.  Finally the 93 parameters
are tuned by SPSA on LTC.

STC
ELO: 3.46 +-2.2 (95%) LOS: 99.9%
Total: 40000 W: 8275 L: 7877 D: 23848

LTC
LLR: 2.96 (-2.94,2.94) [0.00,6.00]
Total: 10311 W: 1876 L: 1721 D: 6714

Bench: 9498821

Resolves #163
2014-12-21 01:53:44 +08:00
Marco Costalba
9cae6e66ce Don't account for Tempo in specialized endgames
The evaluation is already done by the specialized
function, don't need to add something elese later.

With this patch following positions are evaluated
correctly as draws:

8/6p1/1Pkp1p1p/2nNn2P/2P1K1P1/8/8/3B4 w - - 7
8/1k4p1/1P1p1p1p/3NnK1P/2P3P1/1n6/4B3/8 w - -

Verified it not regress with an STC test:
LLR: 3.15 (-2.94,2.94) [-3.00,1.00]
Total: 49812 W: 10095 L: 10016 D: 29701

Reported by Arjun Temurnikar.

bench: 8289983
2014-12-19 11:06:40 +01:00
mstembera
46d5fff01f Change profile-build options to produce 1% to 2% faster executables.
The "@rm ucioption.gc*" line is necessary to avoid a gcc 4.7.x bug.
Confirmed for gcc 4.7.4, 4.8.1, and 4.9.1
Suggested by Kiran Panditrao on fishcooking forum.
https://groups.google.com/forum/?fromgroups=#!topic/fishcooking/AY8gN53nG18

No functional change.

Resolves #160
2014-12-19 03:57:04 +08:00
Marco Costalba
b8fd1a78dc Improve comments in UCI
And simplify naming while there.

No functional change.

Resolves #159
2014-12-14 23:50:33 +00:00
Marco Costalba
413b243809 Coding style in TT code
In particular seems more natural to return
bool and TTEntry on the same line, actually
we should pass and return them as a pair,
but due to limitations of C++ and not wanting
to use std::pair this can be an acceptable
compromise.

No functional change.

Resolves #157
2014-12-14 23:49:00 +00:00
Gary Linscott
0edb6348d2 Fix compile for some versions of mingw
The bswap intrinsics are specific to the compiler, not the
host platform.

No functional change.

Resolves #155
2014-12-14 14:45:43 -05:00
mstembera
14cf27e6f6 Avoid searching TT twice for the same key/position during probe() and store().
Just keep the pointer and remove code from tt.cpp

STC
LLR: 2.96 (-2.94,2.94) [-1.50,4.50]
Total: 13620 W: 2810 L: 2665 D: 8145

LTC
LLR: 2.97 (-2.94,2.94) [0.00,6.00]
Total: 13021 W: 2238 L: 2073 D: 8710STC http://tests.stockfishchess.org/tests/view/548436860ebc59331739b90c

STC 4MB
ELO: 2.41 +-2.2 (95%) LOS: 98.6%
Total: 40000 W: 8175 L: 7897 D: 23928

LTC 16MB
ELO: 1.78 +-2.0 (95%) LOS: 96.1%
Total: 39683 W: 6763 L: 6560 D: 26360

Resolves #151

Bench: 8116521
2014-12-13 07:22:37 +00:00
Gary Linscott
7b4828b68c Only use _ReadWriteBarrier on MSVC
It was causing compile errors when cross-compiling using mingw.

No functional change.
2014-12-11 14:56:24 -05:00
joergoster
f6d220ab14 Halve StormDanger bonus for blocked pawn on A/H file
STC
LLR: 2.95 (-2.94,2.94) [-1.50,4.50]
Total: 3410 W: 758 L: 641 D: 2011

LTC
LLR: 2.95 (-2.94,2.94) [0.00,6.00]
Total: 33225 W: 5708 L: 5445 D: 22072

Bench: 8465811

Resolves #153
2014-12-11 13:08:29 -05:00
Gary Linscott
afafdf7b73 MSVC compiling fixes
No functional change.

Resolves #150
2014-12-11 13:03:44 -05:00
Joona Kiiski
b15dcd9774 Fix profile build for syzygy
Touch source files under syzygy directory to force recompilation
after collecting profile data.

No functional change

Resolves #149
2014-12-10 17:59:41 +00:00
Joona Kiiski
94dd204c3b Retire 'os' flag from Makefile
Appears to be unused

No functional change

Resolves #147
2014-12-10 17:57:55 +00:00
Marco Costalba
5943600a89 Assorted nitpicking code-style
No functional change.
2014-12-10 12:38:13 +01:00
Marco Costalba
589c711449 Clarify when forcing the moves loop
In some cases we want to go direcly to the moves loop
without checking for early return. The patch make this
logic more clear and consistent.

Tested for no regression, passed STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 25282 W: 5136 L: 5022 D: 15124

and LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 72007 W: 12133 L: 12095 D: 47779

bench: 9316798
2014-12-10 12:35:21 +01:00
Ernesto Gatti
158864270a Simpler PRNG and faster magics search
This patch replaces RKISS by a simpler and faster PRNG, xorshift64* proposed
by S. Vigna (2014). It is extremely simple, has a large enough period for
Stockfish's needs (2^64), requires no warming-up (allowing such code to be
removed), and offers slightly better randomness than MT19937.

Paper: http://xorshift.di.unimi.it/
Reference source code (public domain):
http://xorshift.di.unimi.it/xorshift64star.c

The patch also simplifies how init_magics() searches for magics:

- Old logic: seed the PRNG always with the same seed,
  then use optimized bit rotations to tailor the RNG sequence per rank.

- New logic: seed the PRNG with an optimized seed per rank.

This has two advantages:
1. Less code and less computation to perform during magics search (not ROTL).
2. More choices for random sequence tuning. The old logic only let us choose
from 4096 bit rotation pairs. With the new one, we can look for the best seeds
among 2^64 values. Indeed, the set of seeds[][] provided in the patch reduces
the effort needed to find the magics:

64-bit SF:
Old logic -> 5,783,789 rand64() calls needed to find the magics
New logic -> 4,420,086 calls

32-bit SF:
Old logic -> 2,175,518 calls
New logic -> 1,895,955 calls

In the 64-bit case, init_magics() take 25 ms less to complete (Intel Core i5).

Finally, when playing with strength handicap, non-determinism is achieved
by setting the seed of the static RNG only once. Afterwards, there is no need
to skip output values.

The bench only changes because the Zobrist keys are now different (since they
are random numbers straight out of the PRNG).

The RNG seed has been carefully chosen so that the
resulting Zobrist keys are particularly well-behaved:

1. All triplets of XORed keys are unique, implying that it
   would take at least 7 keys to find a 64-bit collision
   (test suggested by ceebo)

2. All pairs of XORed keys are unique modulo 2^32

3. The cardinality of { (key1 ^ key2) >> 48 } is as close
   as possible to the maximum (65536)

Point 2 aims at ensuring a good distribution among the bits
that determine an TT entry's cluster, likewise point 3
among the bits that form the TT entry's key16 inside a
cluster.

Details:

     Bitset   card(key1^key2)
     ------   ---------------
RKISS
     key16     64894   = 99.020% of theoretical maximum
     low18    180117   = 99.293%
     low32    305362   = 99.997%

Xorshift64*, old seed
     key16     64918   = 99.057%
     low18    179994   = 99.225%
     low32    305350   = 99.993%

Xorshift64*, new seed
     key16     65027   = 99.223%
     low18    181118   = 99.845%
     low32    305371   = 100.000%

Bench: 9324905

Resolves #148
2014-12-08 08:18:26 +08:00
Gary Linscott
a87da2c4b3 Add some tablebase positions to bench
This makes it easier to check for regressions in the tablebase code.

Bench: 9489202
5-man bench: 8943906

Resolves #145
2014-12-08 07:58:05 +08:00
hxim
fbb53524ef Rename some variables for more clarity.
No functional change.

Resolves #131
2014-12-08 07:53:33 +08:00
Marco Costalba
ba1464751d Explicitly pass RootMoves to TB probes
Currently Search::RootMoves is accessed and even
modified by TB probing functions in a hidden
and sneaky way.

This is bad practice and makes the code tricky.
Instead explicily pass the vector as function
argument so to clarify that the vector is modified
inside the functions.

No functional change.
2014-12-06 15:08:21 +00:00
Marco Costalba
eeb6d923fa Move TB stuff under Tablebases namespace
Simplified also some logic while there.

TBLargest needs renaming too, but itis for
a future patch because touches also syzygy
directory stuff.

No functional change.
2014-12-06 14:58:00 +00:00
Marco Costalba
c30eb4c9c9 Refactor syzygy code in search
Move to SF coding style.

Also skip calculating piece count in search()
when TB are not found (!TBCardinality)

No functional change.
2014-12-06 14:35:50 +00:00
Joona Kiiski
35c1ccef39 Retire support for Haiku installation directory from Makefile
- It is out of the scope of the project.
- It is the responsibility of Haiku package maintainer to
  configure this.

No functional change

Resolves #143
2014-12-06 14:23:08 +00:00
Joona Kiiski
0935dca9a6 Retire hackish support for aCC and HP-UX from Makefile
- It is out of scope of the project.
- We have no way to verify that it even works anymore

No functional change

Resolves #142
2014-12-06 14:19:39 +00:00
Marco Costalba
314d446518 Retire total_piece_count()
We really don't need to uglify in this way
our nice count() API with this ad-hoc hack.

So remove the hack and use the already
existing infrastructure.

No functional change.

Resolves #134
2014-11-30 20:37:24 +00:00
hxim
c014444f09 Remove CONNECTED_KINGS from Syzygy code
No functional change

Resolves #140
2014-11-30 20:24:32 +00:00
Rodrigo Exterckötter Tjäder
9b4e123fbe Cleaning Syzygy profiling data
Updating the makefile so that the clean and gcc-profile-clean targets also
remove the profiling data files in the syzygy directory.

No functional change.

Resolves #136
2014-11-30 19:53:04 +00:00
Marco Costalba
a43f633c19 Rewrite TBScore in uci_pv()
Streamline the code and make
it understandable.

No functional change.

Resolves #135
2014-11-30 19:35:35 +00:00
Marco Costalba
66f5cd3f9d Retire #ifdef SYZYGY macro
It just clutters the code for no
real reason.

No functional change.

Resolves #139
2014-11-30 19:23:17 +00:00
mstembera
fe07ae4cb4 Bitbase index() from ADD to OR.
No functional change.

Resolves #132
2014-11-26 07:56:48 +08:00
lucasart
2c52147dbf Introduce ratio operation
Just like in Physics, the ratio of 2 things in the same unit, should be
without unit.

Example use case:
- Ratio of a Depth by a Depth (eg. ONE_PLY) should be an int.
- Ratio of a Value by a Value (eg. PawnValueEg) should be an int.

Remove a bunch of useless const while there.

No functional change.

Resolves #128
2014-11-26 07:55:57 +08:00
Ronald de Man
7caa6cd338 Syzygy tablebases
Adds support for Syzygy tablebases to Stockfish.  See
the Readme for information on using the tablebases.

Tablebase support can be enabled/disabled at the Makefile
level as well, by setting syzygy=yes or syzygy=no.

Big/little endian are both supported.

No functional change (if Tablebases are not used).

Resolves #6
2014-11-26 07:49:58 +08:00
Gary Linscott
4509eb1342 Fix out-of-bound array access printing ponder move
It is possible that we won't have a ponder move if our PV
is too short.  In that case, just don't print a ponder move.

No functional change

Resolves #130
2014-11-24 08:53:00 +08:00
Gary Linscott
7ad59d9ac9 Fix pondering
The UCI specification states that an engine can never exit the search
while pondering.

No functional change.

Resolves #118
2014-11-24 08:50:36 +08:00
Jonathan Calovski
48127fe5d3 Amend defended
Amend defended to remove now redundant condition.

No functional change.

Resolves #125
2014-11-22 05:46:59 +08:00
Marco Costalba
84408e5cd6 Fix doubled pawns asymmetry
When evaluating double pawns we use always
lsb() to extract the frontmost square.

This breaks evaluation color symmetry as is
possible to verify with an instrumented evaluate()

  Value evaluate(const Position& pos) {

    Value v = do_evaluate<false>(pos);
    Position p = pos;
    p.flip();
    assert(v == do_evaluate<false>(p));
    return v;
  }

Passed no regression test:

STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 21035 W: 4244 L: 4122 D: 12669

LTC
LLR: 2.95 (-2.94,2.94) [-3.00,1.00]
Total: 39839 W: 6662 L: 6572 D: 26605

bench: 8255966
2014-11-21 20:40:25 +01:00
Marco Costalba
79232be02a Further tweak accurate pv
It is a non functional change, but because
we now skip copying of pv[] in SpNode, patch
has been tested for regression with 3 threads:

STC
LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 54668 W: 9873 L: 9809 D: 34986

No functional change.
2014-11-21 20:37:45 +01:00
hxim
0a1f54975f Fix some comments
No functional change.

Resolves #123
2014-11-19 06:39:17 +08:00
Gary Linscott
bffe32f4fe Fix fen output for castling rights
This is a regression from 428962a

We have to cast to char here, otherwise the compiler
interprets it as an integer, and writes a number.

No functional change

Resolves #122
2014-11-19 06:37:59 +08:00
Marco Costalba
4aca11ae2a Codying style in accurate PV
This is the first of a patch series to
rearrange and simplify accurate PV.

In this patch there is simple coding
style and reformatting stuff.

Verified with fishtest it does not crash
with MAX_PLY = 8

No functional change.
2014-11-18 11:57:57 +01:00
Marco Costalba
1a939cd8c8 Fix a warning on Intel C++
warning #2259: non-pointer conversion from "int" to
"uint8_t={unsigned char}" may lose significant bits

No functional change.
2014-11-17 12:56:48 +01:00