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

2656 commits

Author SHA1 Message Date
Marco Costalba
d2eeef89aa Revert "Check for easy move just once"
This reverts commit a24da071f0

Seems a regression when tested against 2.3.1

With this patch, have after 20000 games at 60+0.05, we have

ELO: 13.42 +-4.8 (95%) LOS: 100.0%
Total: 20000 W: 3746 L: 2974 D: 13280

Instead with the patch reverted:

ELO: 16.62 +-4.8 (95%) LOS: 100.0%
Total: 20000 W: 3816 L: 2860 D: 13324

Although we are within error bounds here we take the conservative
approach of not introducing changes that are not proved stronger
It doesn't mean that the change shall be weaker, simply that we
don't want to take any risk.

No functional change.
2013-03-16 11:12:35 +01:00
RyanTaker
70d20326b0 Improved Readability of Material
This is a non-functional change that simply changes the look
of the code to help clarity.

No functional change.
2013-03-15 09:14:00 +01:00
jundery
ccf4ec6768 Do more work between prefetch and querying transposition table
More time to load the cache line before access

No functional change.
2013-03-12 19:58:32 +01:00
Gary Linscott
a24da071f0 Check for easy move just once
Here the rational seems to be that if after one try easy
move detection fails then the easy move is not so easy :-)

After 15563 games at 60+0.05
ELO: 3.04 +-5.5 (95%) LOS: 97.0%
Total: 15563 W: 2664 L: 2528 D: 10371

No functional change.
2013-03-11 22:23:19 +01:00
Gary Linscott
3698d9aa55 Be more aggressive on trying to finish iterations
Increase MaxRatio to use more time when in trouble.

After 16000 games at 60+0.05
ELO: 4.89 +-5.4 (95%) LOS: 99.9%
Total: 16000 W: 2700 L: 2475 D: 10825

No functional change.
2013-03-11 19:07:55 +01:00
Marco Costalba
10429dd616 Increase see prune depth
This seems good at short TC controls.

After 10000 games at 20+0.05
ELO: 9.56 +-6.8 (95%) LOS: 100.0%
Total: 10000 W: 1949 L: 1674 D: 6377

Testing at long TC and regression testing is still
ongoing. So this is a bit speculative commit and
could be reverted in the future.

Also re-testing at long TC the SEE pruning in PV nodes
seems less effective (perhaps even a regression, but
still ongoing) so disabled for now.

bench: 4968764
2013-03-04 09:41:56 +01:00
Marco Costalba
db322e6a63 Revert "Store moves sent with "position" UCI command"
This reverts commit 0d68b523a3.

After easy move semplification this machinery is not
needed anymore (because of we don't need to know if a
root move is a recapture)

No functional change.
2013-03-04 09:29:46 +01:00
Marco Costalba
45dba12c5b Simplify "easy move" detection
Detect a move as easy only if it is the only one ;-)
or if is much better than remaining ones after we
have spent 20% of search time.

Tests are ongoing, but it seems this semplification
stands. Anyhow it is experimental for now and could
be reverted/improved with further work Gary is
testing right now.

No functional change.
2013-03-04 09:27:00 +01:00
Marco Costalba
ccad601389 Avoid locking/unlocking in a tight loop
After previous patch if split point master is
waiting for job and "Use Sleeping Threads" is
false (our condition for official releases) then
it will lock/unlock splitPoint mutex in a super
tight loop badly affecting performance.

Rewrite the code to lock only when we are about
to finish. Note that race condition on slavesMask
is anyhow fixed.

No functional change.
2013-03-04 09:07:48 +01:00
jundery
d165d5af91 Fix race condition where idle_loop() gets called from Split()
SplitPoint member slavesMask wasn't read under lock

No functional change.
2013-03-04 08:52:24 +01:00
jhellis3
3ce43c20de Stop search if only 1 legal move
There is no point searching a move that is forced.
It wastes time while allowing computer opponents to
fill hash with 100% accuracy.

[edit: Condition moved together with "easy move" ones]

Bench identical: 4922272
2013-03-04 08:30:55 +01:00
Marco Costalba
def50020ad Fix easy re-capture case
We detect an easy move as a recapture with an
high margin on the second best move.

Unfortunatly the recapture detection is broken
becuase we identify as a recapture any move that
follows an opponent's previous capture !

This patch fix the logic to correctly detect a
real re-capture.

No functional change.
2013-03-02 13:20:40 +01:00
Marco Costalba
0d68b523a3 Store moves sent with "position" UCI command
Store all the game moves until current position.

This will be used by next patch.

No functional change.
2013-03-02 13:08:50 +01:00
Marco Costalba
0e1ad3ad33 Rename sp to splitPoint
Still keep 'sp' name when used as local
variable with limited scope.

From Jundery.

No functional change.
2013-03-01 09:44:19 +01:00
jundery
0fc9a01933 Remove strange use of the ternary operator
Note that we read shared data without lock
protection, so code is theoretically prone to
torn reads. But, first splitPoint pointer
never changes, and alpha is of integer type so
it is read in a single DWORD access.

No functional change.
2013-03-01 08:05:47 +01:00
jundery
68d1bebd8e Split() clean up locking
Only unlock and relock when idle_loop() is actually called

No functional change
2013-03-01 07:57:18 +01:00
Marco Costalba
57b6df4874 Merge Lucas's "SEE pruning at PV nodes"
bench: 4922272
2013-02-27 08:14:00 +01:00
Marco Costalba
bc38efd128 Remove pruning condition on alpha
Further simplifying on Lucas's idea, seems reliable
in tests:

ELO: 2.15 +-7 (95%) LOS: 84.9%
Total: 9999 W: 1831 L: 1769 D: 6399
2013-02-27 08:07:26 +01:00
Lucas Braesch
335b57b5ef Prune negative SEE moves also in PV nodes
This patch is actually the sum of two contributions that
have been tested independently:

1) Pruning of negative SEE moves in PV

After 10000 games at 20+0.05
ELO: 5.18 +-7 (95%) LOS: 99.2%
Total: 10000 W: 1952 L: 1803 D: 6245

2) Remove of bestValue > VALUE_MATED_IN_MAX_PLY condition

After 23000 games at 20+0.05
ELO: 1.63 +-4 (95%) LOS: 88.1%
Total: 23000 W: 4232 L: 4124 D: 14644

The whole patch as been re-tested at long TC with positive results:

After 10000 games at 60+0.05
ELO: 4.31 +-7 (95%) LOS: 98.3%
Total: 10000 W: 1765 L: 1641 D: 6594
2013-02-27 08:04:32 +01:00
Marco Costalba
dbd28bc7f8 Avoid a tricky line in shelter_storm()
kf = (kf == FILE_A) ? kf++ : ....

is tricky becuase kf is updated twice and it happens
to do the right thing just by accident.

Rewrite in a better way.

Spotted by pdimov

No functional change.
2013-02-23 19:27:32 +01:00
Marco Costalba
ccf21f5595 Convert Readme to markdown format
Looks better on GitHub, that supports this format.

No functional change.
2013-02-23 17:05:28 +01:00
Marco Costalba
1d1fcf80a0 Use DD-MM-YY as date format
In engine name and version number.

No functional change.
2013-02-21 07:19:48 +01:00
Marco Costalba
373503f4a9 Statically link std libraries under mingw
Allows for easier redistribution.

No functional change.
2013-02-21 05:51:04 +01:00
Marco Costalba
9a1d5f0f1d Merge Gary's bishop_pin patch
Give a bonus if a bishop can pin a piece or can
give a discovered check through an x-ray attack.

Seems good after 24000 games at 15"+0.05 (single thread):

ELO: 12.30 +- 99%: 5.79 95%: 4.40 LOS: 100.00%
Total: 24000 W: 4931 L: 4082 D: 14987

bench: 4917064
2013-02-20 12:39:09 +01:00
jundery
d5e49a3ad4 Print leading zeroes in hash keys
And convert to uppercase. Reset the stream to dec too.

[Edit: Also fixed the hash key in Position::pretty()]
2013-02-19 20:06:01 +01:00
Gary Linscott
ea4e22be1d Merge branch 'master' into bishop_pin_clop 2013-02-19 10:31:52 -05:00
Gary Linscott
dc8c6ea2d1 Bring back original bonus 2013-02-19 10:31:50 -05:00
Marco Costalba
c5ec94d0f1 Update copyright year
No functional change.
2013-02-19 07:54:14 +01:00
Gary Linscott
d570260a28 Back to CLOP average values 2013-02-16 22:36:58 -05:00
Marco Costalba
76caef8ba1 Account for gamePly after each move
Rename startPosPly to gamePly and increment/decrement
the variable after each do/undo move. This adds a little
overhead in do_move() but we will need to have the
game ply during the search for the next patches now
under test.

Currently we don't increment gamePly in do_null_move()
becuase it is not needed at the moment. Could change
in the future.

As a nice side effect we can now remove an hack in
startpos_ply_counter().

No functional change.
2013-02-16 12:44:17 +01:00
Marco Costalba
5a156df719 Merge Gary's king safety tweak
Still well within error bars, so probably not a big improvement,
but may be worthwhile. I will let the test keep running. The idea
for the tweak came from the TCEC game against Houdini. Stockfish saw
it as a draw, well past when it should have seen problems. King safety
was off, since it was QN and pawns only, but in fact the king was
quite vulnerable.

After 8000 games at 60/1 (Gary's test)

ELO: -0.43 +- 99%: 10.02 95%: 7.62
Wins: 1235 Losses: 1245 Draws: 5520 Total: 8000

PGN of game against houdini. Moves 55-59 it was seeing a draw, and
Houdini was seeing a good sized advantage for black. With the change,
Stockfish now recognizes that moving the king there is a bad idea.

[Event "nTCEC - Stage 1 - Season 1"]
[Site "http://www.tcec-chess.net"]
[Date "2013.02.07"]
[Round "4.2"]
[White "Stockfish 2.31"]
[Black "Houdini 3.0"]
[Result "0-1"]
[Variant "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ka4 Qa2+ 89. Kb4 f5
90. Qe8+ Kf4 91. Qg6 Qd5 92. Qg1 Qe4+ 93. Ka5 Qe2 94. Qg8 Kf3 95. Qd5+ Qe4
96. Qd1+ Kg2 97. Qd2+ Kf1 98. Qh2 f4 99. Qh3+ Ke2 100. Qg4+ Kd2 101. Qg5 Kc2
102. Qh4 0-1

bench: 5518286
2013-02-15 16:25:33 +01:00
Marco Costalba
e0dfb0bc34 Further speed up bitbase generation
Another trick, along the same lines of previous
patch. This time we first check positions with
white side to move that, becuase we start with
pawn on rank 7, are easily classified as wins,
then black ones.

Number of cycles reduced to 15 !

Becuase now it is faster we can remove a lot of
code to detect theoretical draws. We will calculate
them anyhow, although a bit slower, but the speed
up trick more than compensates it.

Verified that generated bitbases match original ones.

No functional change.
2013-02-15 11:58:33 +01:00
Gary Linscott
3922ac2fe4 Add new clop tuned value 2013-02-14 20:29:24 -05:00
Gary Linscott
66a1a77487 Merge branch 'master' into bishop_pin_clop 2013-02-13 21:41:15 -05:00
Gary Linscott
cd0ecace19 Revert "Use CLOP mean value instead of max"
This reverts commit d0c2faa5fd.
2013-02-13 21:40:38 -05:00
Marco Costalba
10d29add18 Speedup KPK bitbase of 25%
Change the way the index is coded so that
now looping from 0 to IndexMax generates
the pawns from RANK_7 down to RANK2.

Becuase positions with pawns at RANK_7
are easily classified as wins/draws, this
small trick allows to reduce the number
of needed iterations from 30 down to 26!

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2013-02-13 20:13:56 +01:00
Marco Costalba
f2950ae206 Simplify bitbase.cpp
Use a std::vector to store positions and
rearrange KPKPosition.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2013-02-13 20:13:44 +01:00
Gary Linscott
d0c2faa5fd Use CLOP mean value instead of max 2013-02-13 12:21:16 -05:00
Gary Linscott
671f24ff35 Merge branch 'simplify_eval' into bishop_pin_clop 2013-02-13 12:19:54 -05:00
Gary Linscott
f32f899467 CLOP tuned 2013-02-13 00:12:02 -05:00
Gary Linscott
17b71fe51d Add clop parameters 2013-02-12 00:10:21 -05:00
Gary Linscott
30c2e3828a Merge branch 'master' into simplify_eval 2013-02-11 10:26:25 -05:00
Gary Linscott
a7cdf7299a Bishop pins only 2013-02-11 10:26:18 -05:00
Marco Costalba
733d0099b2 Rename and de-templetize sort()
Rename to insertion_sort so to avoid confusion
with std::sort, also move it to movepicker.cpp
and use the bit slower std::stable_sort in
search.cpp where it is used in not performance
critical paths.

No functional change.
2013-02-11 00:09:21 +01:00
Marco Costalba
0be7b8c542 Further simplify first_entry()
We can encode the ClusterSize directly in the
hashMask, this allows to skip the left shift.

There is no real change, but bench number is now
different because instead of using the lowest order
bits of the key to index the start of the cluster,
now we don't use the last two lsb bits that are
always set to zero (cluster size is 4). So for
instance, if 10 bits are used to index the cluster,
instead of bits [9..0] now we use bits [11..2].
This changes the positions that end up in the same
cluster affecting TT hits and so bench is different.

Also some renaming while there.

bench: 5383795
2013-02-09 16:37:20 +01:00
Marco Costalba
c698362680 Microptimize first_entry() for 32bits
Do a 32bit bitwise 'and' instead of a 64bit
subtract and bitwise 'and'.

This is possible because even in the biggest
hash table case (8GB) the number of entries
is 2^29 so storable in an unsigned int.

No functional change.
2013-02-09 10:55:38 +01:00
Marco Costalba
fe3352665b Retire TTCluster and simplify TT
Also some renaming while there.

No functional change.
2013-02-09 10:55:20 +01:00
Marco Costalba
3f44be9baa Simplify move_to_san()
Nicely simplify disambiguation code.

No functional change.
2013-02-09 07:43:53 +01:00
Gary Linscott
0c06b4509d Slight tweak to king safety. Bench: 5534531 2013-02-08 08:53:13 -05:00
Marco Costalba
e5bc79fb9c Retire slavesPositions
Save the current active position in each Thread
instead of keeping a centralized array in struct
SplitPoint.

This allow to skip a memset() call at each split.

No functional change.
2013-02-08 11:45:33 +01:00