]> git.sesse.net Git - stockfish/log
stockfish
11 years agoCheck for easy move just once
Gary Linscott [Sun, 10 Mar 2013 09:06:39 +0000 (10:06 +0100)]
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.

11 years agoBe more aggressive on trying to finish iterations
Gary Linscott [Mon, 4 Mar 2013 15:36:10 +0000 (10:36 -0500)]
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.

11 years agoIncrease see prune depth
Marco Costalba [Mon, 4 Mar 2013 08:38:58 +0000 (09:38 +0100)]
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

11 years agoRevert "Store moves sent with "position" UCI command"
Marco Costalba [Mon, 4 Mar 2013 08:28:21 +0000 (09:28 +0100)]
Revert "Store moves sent with "position" UCI command"

This reverts commit 0d68b523a390e2f5c37f211316869d798e852289.

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.

11 years agoSimplify "easy move" detection
Marco Costalba [Mon, 4 Mar 2013 08:27:00 +0000 (09:27 +0100)]
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.

11 years agoAvoid locking/unlocking in a tight loop
Marco Costalba [Mon, 4 Mar 2013 07:58:57 +0000 (08:58 +0100)]
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.

11 years agoFix race condition where idle_loop() gets called from Split()
jundery [Mon, 4 Mar 2013 06:44:46 +0000 (23:44 -0700)]
Fix race condition where idle_loop() gets called from Split()

SplitPoint member slavesMask wasn't read under lock

No functional change.

11 years agoStop search if only 1 legal move
jhellis3 [Sun, 3 Mar 2013 21:13:05 +0000 (15:13 -0600)]
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

11 years agoFix easy re-capture case
Marco Costalba [Sat, 2 Mar 2013 12:20:40 +0000 (13:20 +0100)]
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.

11 years agoStore moves sent with "position" UCI command
Marco Costalba [Sat, 2 Mar 2013 12:03:56 +0000 (13:03 +0100)]
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.

11 years agoRename sp to splitPoint
Marco Costalba [Fri, 1 Mar 2013 08:38:43 +0000 (09:38 +0100)]
Rename sp to splitPoint

Still keep 'sp' name when used as local
variable with limited scope.

From Jundery.

No functional change.

11 years agoRemove strange use of the ternary operator
jundery [Thu, 28 Feb 2013 05:18:11 +0000 (22:18 -0700)]
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.

11 years agoSplit() clean up locking
jundery [Thu, 28 Feb 2013 00:55:56 +0000 (17:55 -0700)]
Split() clean up locking

Only unlock and relock when idle_loop() is actually called

No functional change

11 years agoMerge Lucas's "SEE pruning at PV nodes"
Marco Costalba [Wed, 27 Feb 2013 07:10:24 +0000 (08:10 +0100)]
Merge Lucas's "SEE pruning at PV nodes"

bench: 4922272

11 years agoRemove pruning condition on alpha
Marco Costalba [Wed, 27 Feb 2013 07:07:26 +0000 (08:07 +0100)]
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

11 years agoPrune negative SEE moves also in PV nodes
Lucas Braesch [Thu, 21 Feb 2013 14:54:06 +0000 (09:54 -0500)]
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

11 years agoAvoid a tricky line in shelter_storm()
Marco Costalba [Sat, 23 Feb 2013 18:27:32 +0000 (19:27 +0100)]
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.

11 years agoConvert Readme to markdown format
Marco Costalba [Sat, 23 Feb 2013 16:00:33 +0000 (17:00 +0100)]
Convert Readme to markdown format

Looks better on GitHub, that supports this format.

No functional change.

11 years agoUse DD-MM-YY as date format
Marco Costalba [Thu, 21 Feb 2013 06:19:03 +0000 (07:19 +0100)]
Use DD-MM-YY as date format

In engine name and version number.

No functional change.

11 years agoStatically link std libraries under mingw
Marco Costalba [Thu, 21 Feb 2013 04:27:26 +0000 (05:27 +0100)]
Statically link std libraries under mingw

Allows for easier redistribution.

No functional change.

11 years agoMerge Gary's bishop_pin patch
Marco Costalba [Wed, 20 Feb 2013 11:19:19 +0000 (12:19 +0100)]
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

11 years agoPrint leading zeroes in hash keys
jundery [Tue, 19 Feb 2013 07:54:16 +0000 (00:54 -0700)]
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()]

11 years agoMerge branch 'master' into bishop_pin_clop
Gary Linscott [Tue, 19 Feb 2013 15:31:52 +0000 (10:31 -0500)]
Merge branch 'master' into bishop_pin_clop

11 years agoBring back original bonus
Gary Linscott [Tue, 19 Feb 2013 15:31:50 +0000 (10:31 -0500)]
Bring back original bonus

11 years agoUpdate copyright year
Marco Costalba [Tue, 19 Feb 2013 06:54:14 +0000 (07:54 +0100)]
Update copyright year

No functional change.

11 years agoBack to CLOP average values
Gary Linscott [Sun, 17 Feb 2013 03:36:58 +0000 (22:36 -0500)]
Back to CLOP average values

11 years agoAccount for gamePly after each move
Marco Costalba [Sat, 16 Feb 2013 11:42:22 +0000 (12:42 +0100)]
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.

11 years agoMerge Gary's king safety tweak
Marco Costalba [Fri, 15 Feb 2013 15:21:15 +0000 (07:21 -0800)]
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 "normal"]

1. Nf3 Nf6 2. c4 e6 3. Nc3 Bb4 4. Qc2 O-O 5. a3 Bxc3 6. Qxc3 b6 7. b4 a5 8. Bb2
axb4 9. axb4 Rxa1+ 10. Bxa1 Na6 11. e3 Qe7 12. b5 Nc5 13. Qc2 Bb7 14. Be2 d6
15. O-O Ra8 16. Bb2 h6 17. Ra1 Rxa1+ 18. Bxa1 e5 19. Qa2 Be4 20. Ne1 Bg6
21. Bb2 Kh7 22. f3 Nfd7 23. Bc3 h5 24. Qa1 h4 25. Kf1 Qf6 26. Qa7 Qd8 27. Qa2
e4 28. Qa1 h3 29. g3 exf3 30. Nxf3 Bf5 31. Bd4 g6 32. Kf2 Kg8 33. Qa3 Bg4
34. d3 Qc8 35. Bxc5 bxc5 36. Ke1 Qb7 37. e4 Bxf3 38. Bxf3 Ne5 39. Be2 Qc8
40. Qa6 Qd8 41. Qa5 Kh7 42. Kd1 Kg7 43. Qa7 Kg8 44. Qa5 Kh7 45. Qa7 Kg7 46. Qa5
Qb8 47. Kd2 Kh7 48. Kc2 Kg8 49. Qa6 Qd8 50. Qa5 Qf6 51. Qe1 Kg7 52. Qf1 Qe6
53. Qe1 Qd7 54. Qc1 Qe8 55. Kc3 Qa8 56. Kb3 Kh7 57. Qa3 Qd8 58. Qc1 c6 59. Qc3
Qb6 60. Ka4 Qb7 61. Qd2 Nd7 62. Qc3 Qa7+ 63. Kb3 Kg8 64. Bg4 cxb5 65. cxb5 Nb6
66. Bxh3 Qa4+ 67. Kb2 Qd1 68. Ka3 Qe2 69. Kb3 Qh5 70. Bg2 Qxh2 71. Qf6 Qxg3
72. Bf1 Qe3 73. Kc2 Na4 74. b6 Nxb6 75. Qd8+ Kg7 76. Qxb6 Qf2+ 77. Kc3 Qxf1
78. Qxd6 Qf6+ 79. Qxf6+ Kxf6 80. Kc4 g5 81. Kxc5 Ke5 82. d4+ Kxe4 83. d5 g4
84. d6 g3 85. d7 g2 86. d8=Q g1=Q+ 87. Kb5 Qb1+ 88. 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

11 years agoFurther speed up bitbase generation
Marco Costalba [Fri, 15 Feb 2013 07:56:04 +0000 (08:56 +0100)]
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.

11 years agoAdd new clop tuned value
Gary Linscott [Fri, 15 Feb 2013 01:29:24 +0000 (20:29 -0500)]
Add new clop tuned value

11 years agoMerge branch 'master' into bishop_pin_clop
Gary Linscott [Thu, 14 Feb 2013 02:41:15 +0000 (21:41 -0500)]
Merge branch 'master' into bishop_pin_clop

11 years agoRevert "Use CLOP mean value instead of max"
Gary Linscott [Thu, 14 Feb 2013 02:40:38 +0000 (21:40 -0500)]
Revert "Use CLOP mean value instead of max"

This reverts commit d0c2faa5fd9ad05f865d2a69b59efab43b2be421.

11 years agoSpeedup KPK bitbase of 25%
Marco Costalba [Wed, 13 Feb 2013 11:26:08 +0000 (12:26 +0100)]
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>
11 years agoSimplify bitbase.cpp
Marco Costalba [Mon, 11 Feb 2013 21:59:37 +0000 (22:59 +0100)]
Simplify bitbase.cpp

Use a std::vector to store positions and
rearrange KPKPosition.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoUse CLOP mean value instead of max
Gary Linscott [Wed, 13 Feb 2013 17:21:16 +0000 (12:21 -0500)]
Use CLOP mean value instead of max

11 years agoMerge branch 'simplify_eval' into bishop_pin_clop
Gary Linscott [Wed, 13 Feb 2013 17:19:54 +0000 (12:19 -0500)]
Merge branch 'simplify_eval' into bishop_pin_clop

11 years agoCLOP tuned
Gary Linscott [Wed, 13 Feb 2013 05:12:02 +0000 (00:12 -0500)]
CLOP tuned

11 years agoAdd clop parameters
Gary Linscott [Tue, 12 Feb 2013 05:10:21 +0000 (00:10 -0500)]
Add clop parameters

11 years agoMerge branch 'master' into simplify_eval
Gary Linscott [Mon, 11 Feb 2013 15:26:25 +0000 (10:26 -0500)]
Merge branch 'master' into simplify_eval

11 years agoBishop pins only
Gary Linscott [Mon, 11 Feb 2013 15:26:18 +0000 (10:26 -0500)]
Bishop pins only

11 years agoRename and de-templetize sort()
Marco Costalba [Sun, 10 Feb 2013 18:10:01 +0000 (19:10 +0100)]
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.

11 years agoFurther simplify first_entry()
Marco Costalba [Sat, 9 Feb 2013 15:22:47 +0000 (16:22 +0100)]
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

11 years agoMicroptimize first_entry() for 32bits
Marco Costalba [Sat, 9 Feb 2013 09:22:34 +0000 (10:22 +0100)]
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.

11 years agoRetire TTCluster and simplify TT
Marco Costalba [Sat, 9 Feb 2013 07:17:03 +0000 (08:17 +0100)]
Retire TTCluster and simplify TT

Also some renaming while there.

No functional change.

11 years agoSimplify move_to_san()
Marco Costalba [Sat, 9 Feb 2013 05:40:46 +0000 (06:40 +0100)]
Simplify move_to_san()

Nicely simplify disambiguation code.

No functional change.

11 years agoSlight tweak to king safety. Bench: 5534531
Gary Linscott [Fri, 8 Feb 2013 13:53:13 +0000 (08:53 -0500)]
Slight tweak to king safety.  Bench: 5534531

11 years agoRetire slavesPositions
Marco Costalba [Fri, 8 Feb 2013 10:04:07 +0000 (11:04 +0100)]
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.

11 years agoAdd const qualifer to go()
Marco Costalba [Fri, 8 Feb 2013 09:05:04 +0000 (10:05 +0100)]
Add const qualifer to go()

Obsolete renmant of when position was directly
passed to the search instead of being copied
for the main thread as is now.

From Jundery.

No functional change.

11 years agoWorkaround value-initialization in MSVC
Marco Costalba [Fri, 8 Feb 2013 07:49:36 +0000 (08:49 +0100)]
Workaround value-initialization in MSVC

The syntax splitPoints() should force the compiler to
value-initialize the array and because there is no
user defined c'tor it falls back on zero-initialization.

Unfortunatly this is broken in MSVC compilers, because
value initialization for non-POD types is not supported,
so left splitPoints un-initialized and add in split()
initialization of slavesPositions, that is the only
member not already set at split time.

This fixes an assert under MSVC when running with
more than one thread.

Spotted and reported by Jundery.

No functional change.

11 years agoAdd KBPKP endgame
Gary Linscott [Sun, 3 Feb 2013 20:42:51 +0000 (15:42 -0500)]
Add KBPKP endgame

It is a draw if pawns are on G or B files, weaker pawn is
on rank 7 and bishop can't attack the pawn.

No functional change (because it is very rare and does not appear in bench)

11 years agoChange slave_available() API
Marco Costalba [Wed, 6 Feb 2013 08:36:13 +0000 (09:36 +0100)]
Change slave_available() API

To return a pointer to the available
thread instead of a bool. This allows
to simplify the core loop in split().

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRename posKey stored in the transposition table
jundery [Tue, 5 Feb 2013 17:02:54 +0000 (10:02 -0700)]
Rename posKey stored in the transposition table

[Edit: Slightly extended by me]

No functional change.

11 years agoAdd const qualifer to check_is_dangerous
jundery [Tue, 5 Feb 2013 17:06:37 +0000 (10:06 -0700)]
Add const qualifer to check_is_dangerous

No functional change.

11 years agoSlightly change split() API
Marco Costalba [Tue, 5 Feb 2013 05:30:05 +0000 (06:30 +0100)]
Slightly change split() API

This function "returns" two values: bestValue and bestMove

Instead of returning one and passing as pointer the other
be consistent and pass as pointers both.

No functional change.

11 years agoDerive ThreadPool from std::vector
Marco Costalba [Mon, 4 Feb 2013 21:38:42 +0000 (22:38 +0100)]
Derive ThreadPool from std::vector

Prefer sub-classing to composition in this case.

No functional change.

11 years agoMove split() under Thread
Marco Costalba [Mon, 4 Feb 2013 21:09:52 +0000 (22:09 +0100)]
Move split() under Thread

Previous renaming patch suggested this reformat:
when a better naming leads to a better code!

No functional change.

11 years agoSome renaming in split()
Marco Costalba [Mon, 4 Feb 2013 18:48:56 +0000 (19:48 +0100)]
Some renaming in split()

Naming suggested by jundery.

No functional change.

11 years agoBe clear about not LMR the ttMove
Marco Costalba [Sun, 3 Feb 2013 10:14:21 +0000 (11:14 +0100)]
Be clear about not LMR the ttMove

Currently a ttMove is reduced with ss->reduction = DEPTH_ZERO,
so it is actually not reduced (as it should be), but the
trick works just becuase it happens that ttMove is the first
to be tried and

reduction(depth, 1)

Always returns zero. So explicitly forbid reduction of ttMove
in the LMR condition. This is much clear and self-documented.

No functional change.

11 years agoTempletize score_xxx() functions
Marco Costalba [Sun, 3 Feb 2013 08:52:39 +0000 (09:52 +0100)]
Templetize score_xxx() functions

So to be style-wise aligned with the corresponding
generate() functions.

No functional change.

11 years agoRename prevents_move() to refutes()
Marco Costalba [Sun, 3 Feb 2013 08:16:44 +0000 (09:16 +0100)]
Rename prevents_move() to refutes()

Better! From DiscoCheck.

No functional change.

11 years agoCorrectly score enpassant captures
Marco Costalba [Sun, 3 Feb 2013 08:01:55 +0000 (09:01 +0100)]
Correctly score enpassant captures

Surprisingly this rare case was not considered
when scoring a capture.

Also take in account that in the promotion case
we gain a new piece (typically a queen) but we
lose the promoting pawn.

These small issues were present since Glaurung times!

Found while browsing DiscoCheck sources

bench: 5400063

11 years agoUnify History and Gains under a single Stats class
Marco Costalba [Sat, 2 Feb 2013 16:13:33 +0000 (17:13 +0100)]
Unify History and Gains under a single Stats class

Handling of History and Gains is almost the same, with
the exception of the update logic, so unify both
classes under a single Stats struct.

No functional change.

11 years agoRetire history.h
Marco Costalba [Sat, 2 Feb 2013 15:04:41 +0000 (16:04 +0100)]
Retire history.h

And move the contents to movepick.cpp, where they are
mostly used.

Idea from DiscoCheck.

No functional change (bench 5379503)

11 years agoSimplify eval take 2. Bench 5097444
Gary Linscott [Sat, 2 Feb 2013 15:19:59 +0000 (10:19 -0500)]
Simplify eval take 2.  Bench 5097444

11 years agoRestore "fail-low of reduced" and close regression
Marco Costalba [Sat, 2 Feb 2013 05:44:20 +0000 (06:44 +0100)]
Restore "fail-low of reduced" and close regression

This reverts "Threat Extensions" and is the last of
this revert series.

In single-thread tests we should now be on par with 2.3.1

11 years agoRevert "Simplify Evaluation"
Marco Costalba [Sat, 2 Feb 2013 05:43:11 +0000 (06:43 +0100)]
Revert "Simplify Evaluation"

This reverts commit 496c7497cb81de4383

11 years agoRevert "Extend full 3 fold detection to PvNodes"
Marco Costalba [Mon, 28 Jan 2013 16:24:01 +0000 (17:24 +0100)]
Revert "Extend full 3 fold detection to PvNodes"

11 years agoRewrite do_castle_move()
Marco Costalba [Sun, 27 Jan 2013 17:48:27 +0000 (18:48 +0100)]
Rewrite do_castle_move()

And handle the castle directly in do/undo_move().
This allow to greatly simplify the code.

Here the beast is the nasty Chess960 that is
really tricky to get it right because could be
that 'from' and 'to' squares are the same or
that king's 'to' square is rook's 'from' square.

Anyhow should work: verified on all Chess960
starting positions.

No functional and no speed change also in Chess960.

11 years agoRewrite do_null_move()
Marco Costalba [Sun, 27 Jan 2013 10:45:01 +0000 (11:45 +0100)]
Rewrite do_null_move()

Use a more traditional approach, along the same lines
of do_move().

It is true that we copy more in do_null_move(), but we
save the work in undo_null_move(). Speed test shows the
new code to be even a bit faster.

No functional change.

11 years agoGet rid of some locals in do_castle_move()
Marco Costalba [Sun, 27 Jan 2013 09:56:03 +0000 (10:56 +0100)]
Get rid of some locals in do_castle_move()

Rewrite the logic to get rid of kBefore and rBefore.

No functional change.

11 years agoDon't prefetch if not needed
Marco Costalba [Sun, 27 Jan 2013 09:15:59 +0000 (10:15 +0100)]
Don't prefetch if not needed

Prefetch access to hash tables only in case we
have changed pawn or material hash keys.

No functional change.

11 years agoRetire generate_king_moves()
Marco Costalba [Sat, 26 Jan 2013 21:07:28 +0000 (22:07 +0100)]
Retire generate_king_moves()

We have only one call place so inline its content.
BTW, function is already declared as FORCE_INLINE.

Also some small refactoring while there.

No functional change.

11 years agoBring back just bishop pins
Gary Linscott [Sat, 26 Jan 2013 20:35:00 +0000 (15:35 -0500)]
Bring back just bishop pins

11 years agoClarify slavesMask usage
Marco Costalba [Sat, 26 Jan 2013 13:23:37 +0000 (14:23 +0100)]
Clarify slavesMask usage

When a thread is allocated a bit is set in slavesMask.
This bit corresponds to the thread's index field that,
because it happens to be the position in the threads
array, eventually it is equal to the loop index 'i'.

But instead of relying on this 'coincidence', explicitly
use the 'idx' field so to clarify slavesMask usage.

Backported from c++11 branch.

No functional change.

11 years agoRevert "Further push singular extension"
Marco Costalba [Mon, 21 Jan 2013 22:14:10 +0000 (23:14 +0100)]
Revert "Further push singular extension"

This reverts commit 4c91dbc28e8bb6265f8

Seems a regression on extended test by both Gary and me.

11 years agoMerge branch 'simplify_eval' of https://github.com/glinscott/Stockfish
Marco Costalba [Fri, 25 Jan 2013 20:01:24 +0000 (21:01 +0100)]
Merge branch 'simplify_eval' of https://github.com/glinscott/Stockfish

Test results are looking good after 12500 games.

ELO: 6.55 +- 99%: 8.02 95%: 6.09
LOS: 99.99%
Wins: 1968 Losses: 1732 Draws: 8813

Also, here are the noise.py results, which seem to have stabilized:
Games: 12526 , result: [1969, 1734, 8823]
Estimated ELO: 6.94963842777
Noise as function of number of games:
['81.89', '565.26', '110.87', '104.39', '38.22', '49.98', '18.56', '16.76',
'11.02', '8.90', '17.36', '9.84', '10.81', '5.13', '6.22', '3.32', '5.83',
'7.21', '15.27', '1.63', '4.04', '9.51', '0.54', '0.75', '1.06', '2.93',
'4.59', '6.85', '13.62', '9.87', '14.74', '20.46', '22.18', '24.33', '31.02',
'34.99', '35.22', '33.22', '32.46', '37.02', '29.10', '36.34', '42.11', '39.33',
'26.16', '28.25', '35.42', '31.04', '29.26', '23.91', '22.52', '23.49', '20.00',
'24.39', '17.22', '16.50', '10.69', '9.15', '9.57', '4.77', '6.67', '3.87', '2.57',
'2.84', '2.60', '3.32', '2.08', '2.93', '4.47', '4.41', '4.83', '4.86', '6.40',
'5.98', '6.10', '6.83', '5.83', '6.22', '5.71', '8.52', '9.25', '5.98', '7.52',
'7.76', '8.76', '8.55', '8.64', '7.19', '5.83', '4.59', '4.77', '4.26', '4.98',
'5.29', '5.41', '4.92', '5.59']

bench: 5229106

11 years agoSimplify evaluation
Gary Linscott [Thu, 24 Jan 2013 13:54:13 +0000 (08:54 -0500)]
Simplify evaluation

11 years agoSmall reformat of split()
Marco Costalba [Mon, 21 Jan 2013 16:22:31 +0000 (17:22 +0100)]
Small reformat of split()

No functional chhange.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix an idiotic icc warning
Marco Costalba [Sun, 20 Jan 2013 16:24:06 +0000 (17:24 +0100)]
Fix an idiotic icc warning

Intel Compiler has 'invented' this pearl:

warning #1476: field uses tail padding of a base class

Just becuase we have subclassed MainThread and added
the field 'bool thinking'.

Pure nosense. Silence the warning.

No functional change.

11 years agoFuther renaming in thread.cpp
Marco Costalba [Sun, 20 Jan 2013 10:54:30 +0000 (11:54 +0100)]
Futher renaming in thread.cpp

No functional change.

11 years agoBig renaming in thread stuff
Marco Costalba [Wed, 16 Jan 2013 08:28:41 +0000 (09:28 +0100)]
Big renaming in thread stuff

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoFix race while exiting
Marco Costalba [Wed, 16 Jan 2013 08:26:10 +0000 (09:26 +0100)]
Fix race while exiting

Fix again TimerThread::idle_loop() to prevent a
theoretical race with 'exit' flag in ~Thread().

Indeed in Thread d'tor we raise 'exit' and then
call notify() that is lock protected, so we
have to check again for 'exit' before going to
sleep in idle_loop().

Also same change in Thread::idle_loop() where we
now check for 'exit' before to go to sleep.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
11 years agoRemove Threat Extension
Lucas Braesch [Tue, 1 Jan 2013 03:51:35 +0000 (11:51 +0800)]
Remove Threat Extension

Great code simplification: - instead do not futility
prune threat refutations. allows_move() is therefore removed.

4000 games at 50,000 nodes/move:
1085-989-1926 [51.2%] LOS=98.3%

4000 games in 10"+0.1"
756-751-2493 [50.1%] LOS=55.1%

EDIT: I have retested the patch of Lucas in a slightly different form
(without pruning in PvNode) and test mre or less confirms that
60 lines of code are totally unuseful:

After 6195 games at 15"+0.05"
1333 - 1325 - 3537 ELO 0

bench 5140990

11 years agoFix a bug in timer loop
Marco Costalba [Mon, 14 Jan 2013 18:32:30 +0000 (19:32 +0100)]
Fix a bug in timer loop

Silly logic bug introduced in dda7de17e74d7e8

Timer thread, when msec = 0, instead of going
to sleep, calls check_time() in an endless loop.

Spotted and reported by snino64 due to abnormally
high CPU usage.

No functional change.

11 years agoPolymorphic Thread hierarchy
Marco Costalba [Sun, 13 Jan 2013 23:32:30 +0000 (00:32 +0100)]
Polymorphic Thread hierarchy

Subclass MainThread and TimerThread and declare
idle_loop() virtual. This allow us to cleanly
remove a good bunch of hacks, relying on C++
polymorphism to do the job.

No functional change.

11 years agoDon't use do_sleep flag
Marco Costalba [Sun, 13 Jan 2013 17:38:44 +0000 (18:38 +0100)]
Don't use do_sleep flag

Rename it is_finished and use it only in main
thread to signal search is finished. This allows
us to simplify the complex SMP logic.

Ultra tricky patch: deep test is required under
wide conditions like pondering on and option
"Use Sleeping Threads" set to false.

No functional change.

11 years agoRe-add the hack
Marco Costalba [Sun, 13 Jan 2013 22:51:15 +0000 (23:51 +0100)]
Re-add the hack

This reverts commit 869c9244101

I misunderstood here. Actually it can happen that
thread is created but still not entered idle_loop
and at the same time start_searching() is called.

Becuase 'do_sleep' is set start_searching() will
set it to false and start the search, but when,
at last, the thread enters idle_loop(), resets
the flag and goes to sleep: not what we want.

Revert the hack waiting for a better solution
in the next patches.

No functional change.

11 years agoRetire set_timer()
Marco Costalba [Sun, 13 Jan 2013 17:22:33 +0000 (18:22 +0100)]
Retire set_timer()

Also assure in Thread::timer_loop() that when
timer interval is 0 (timer is disabled) we
never call check_time()

No functional change.

11 years agoRetire obsolete race hack
Marco Costalba [Sun, 13 Jan 2013 16:04:39 +0000 (17:04 +0100)]
Retire obsolete race hack

This hack was introduced in d282cf6964d493
to workaround a race with start_searching(),
but these days is no more needed.

No functional change.

11 years agoRetire Threads wake_up() and sleep()
Marco Costalba [Sun, 13 Jan 2013 14:50:57 +0000 (15:50 +0100)]
Retire Threads wake_up() and sleep()

These functions are used in just one place.
And generalize wait_for_stop()

No functional change.

11 years agoRename wake_up() to notify_one()
Marco Costalba [Sun, 13 Jan 2013 14:35:38 +0000 (15:35 +0100)]
Rename wake_up() to notify_one()

To align to C++ std::thread conventions.

No functional change.

11 years agoUnify 'ponderhit' handling
Marco Costalba [Sun, 13 Jan 2013 13:36:27 +0000 (14:36 +0100)]
Unify 'ponderhit' handling

Finally we can now merge the 'ponderhit' case with
'stop' and 'quit'.

The patches have been done step by step to help debugging
becuase this is really tricky code.

No functional change.

11 years agoSmall change to "ponderhit" handling
Marco Costalba [Sun, 13 Jan 2013 13:28:22 +0000 (14:28 +0100)]
Small change to "ponderhit" handling

Reset Limits.ponder only if search continue, but if
we are going to stop the search there is no need
(and is also confusing) to clear the 'ponder' flag.

This mimics the behaviour upon rceiving 'stop' when
pondering.

No functional change.

11 years agoSimplify and rename wait_for_stop_or_ponderhit()
Marco Costalba [Sun, 13 Jan 2013 13:15:19 +0000 (14:15 +0100)]
Simplify and rename wait_for_stop_or_ponderhit()

Setting stopOnPonderhit is now done by the caller.

No functional change.

11 years agoSimplify a condition in search()
Marco Costalba [Sun, 13 Jan 2013 11:34:31 +0000 (12:34 +0100)]
Simplify a condition in search()

And rearrange best value update in case of SpNode.

No functional change.

11 years agoClarify SAN disambiguation in case of a pinned piece
Marco Costalba [Sat, 12 Jan 2013 12:19:06 +0000 (13:19 +0100)]
Clarify SAN disambiguation in case of a pinned piece

In SAN notation when two pieces of the same type can
move to a given destination square, a disambiguation
additional info (like starting file) shall be added
to the SAN move.

If one of the two pieces is pinned, the corresponding
move _could_ be illegal and in this case disambiguation
is not needed. But to be pinned alone it is not enough
to deduce that the move is illegal, for instance in this
position:

R3rk2/2r6/8/8/8/8/8/K7 b - - 0 1

The move Rc8 is ambiguous although the rook in e8 is pinned
and the correct SAN notation should be Rcc8.

No functional change.

11 years agoAsync 'stop' command
Marco Costalba [Sun, 6 Jan 2013 11:49:01 +0000 (12:49 +0100)]
Async 'stop' command

Don't wait for the search to finish after a 'stop'
command, but keep processing the GUI input if any.

Also explicitly wake up the main thread (that could be
sleeping) after a 'stop' or 'quit' command and do not
rely on wait_for_search_finished() doing it for us.

This patch cleans up the code and functions's definitions,
but it is risky and needs a good test under different
conditions to be sure it does not introduces hungs up.

No functional change.

11 years agoRevert so called "fromNull patch"
Marco Costalba [Sun, 6 Jan 2013 21:55:35 +0000 (22:55 +0100)]
Revert so called "fromNull patch"

Revert patch c581b7ea3627482

Seems a regression after testing from Gary:
ELO: 7.24 +- 99%: 17.03 95%: 12.93
LOS: 97.86%
Wins: 439 Losses: 381 Draws: 1962

And mine:
After 5410 games at 15"+0.05
Wins: 936 Losses: 1141 Draws: 3333  ELO -13

Moreover we know that there is a regression in the range
of patches which include the fromNull patch.

Probably this is not the only regression since 2.3.1 and
perhaps the idea under fromNull is good, but at the moment,
while in deep regression hunting, better to be on the safe
side and revert it entirely.

My guess on why this is a regression is that using the
negated evaluation of previous ply in case of null search
fails to take in account the king safety asymmetry between
the two colors. This is of course just a guess.

bench 5503830

11 years agoHave fun with union in book.cpp
Marco Costalba [Sat, 5 Jan 2013 14:24:18 +0000 (15:24 +0100)]
Have fun with union in book.cpp

Fancy way to use an union to map polyglot
zobrist keys in one go.

Also some renaming while there.

No functional change.

11 years agoRetire 'Cowardice' and 'Aggressiveness' UCI options
Marco Costalba [Fri, 4 Jan 2013 15:49:24 +0000 (16:49 +0100)]
Retire 'Cowardice' and 'Aggressiveness' UCI options

They are not self-describing and create a lot of user
requests about them.

Given that the values are already well tuned there
is no need to expose them as UCI options.

No functional change.