]> git.sesse.net Git - stockfish/log
stockfish
13 years agoTriviality in data_available()
Marco Costalba [Sat, 8 Jan 2011 11:53:41 +0000 (12:53 +0100)]
Triviality in data_available()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoForce inlining of move generation functions
Marco Costalba [Fri, 7 Jan 2011 15:33:15 +0000 (16:33 +0100)]
Force inlining of move generation functions

MSVC (and possibly other compilers) does not inline
as requested, so force it to do so.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSmall tweak to generate_castle_moves()
Marco Costalba [Fri, 7 Jan 2011 14:17:28 +0000 (15:17 +0100)]
Small tweak to generate_castle_moves()

Move the castling condition test out of the
function. This avoids a function call most of
the times.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUnify move generation
Marco Costalba [Wed, 5 Jan 2011 18:47:01 +0000 (19:47 +0100)]
Unify move generation

Functional change due only to moves reorder. Anyhow after
5242 games at 15"+0.1 TC verified we have no regression.

Mod vs Orig 994 - 958 - 3290 +2 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoTempletize move generation API
Marco Costalba [Wed, 5 Jan 2011 18:00:30 +0000 (19:00 +0100)]
Templetize move generation API

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire move.cpp
Marco Costalba [Fri, 7 Jan 2011 12:00:25 +0000 (13:00 +0100)]
Retire move.cpp

Move its functions where they belong.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse 16 bits to store a move instead of 17
Marco Costalba [Fri, 7 Jan 2011 10:50:38 +0000 (11:50 +0100)]
Use 16 bits to store a move instead of 17

Shrink of 1 bit so to fit a move in an uint_16 and
possibly a MoveStack in an uint_32.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse a 32 bit bitwise 'and' in SimpleHash lookup
Marco Costalba [Fri, 7 Jan 2011 10:10:20 +0000 (11:10 +0100)]
Use a 32 bit bitwise 'and' in SimpleHash lookup

A bit faster on 32 bits machines, more similar to
TranspositionTable::first_entry() and same result.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoIntroduce SimpleHash class
Marco Costalba [Fri, 7 Jan 2011 09:34:16 +0000 (10:34 +0100)]
Introduce SimpleHash class

And use it for pawns and material infos.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSmall tidy up of inttypes for Windows
Marco Costalba [Thu, 6 Jan 2011 22:25:21 +0000 (23:25 +0100)]
Small tidy up of inttypes for Windows

There was a strange "int16" type and "int64_t"
was defined twice.

Spotted by Joona.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSimplify 50 move rule condition
Joona Kiiski [Thu, 6 Jan 2011 13:21:30 +0000 (15:21 +0200)]
Simplify 50 move rule condition

We never reach a position where rule50 > 100.
When rule50 == 100, it's either draw or mate and
there is no way search could go deeper.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoClean up position setup code
Joona Kiiski [Thu, 6 Jan 2011 11:34:16 +0000 (13:34 +0200)]
Clean up position setup code

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoParse halfmove clock and fullmove number from FEN
Joona Kiiski [Thu, 6 Jan 2011 10:13:28 +0000 (12:13 +0200)]
Parse halfmove clock and fullmove number from FEN

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMinimal restructuring of value.h
Joona Kiiski [Thu, 6 Jan 2011 09:15:10 +0000 (11:15 +0200)]
Minimal restructuring of value.h

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoDo not make any assumption on the move in move_is_legal()
Marco Costalba [Thu, 6 Jan 2011 12:33:40 +0000 (13:33 +0100)]
Do not make any assumption on the move in move_is_legal()

We must be able to filter out also moves where move_is_ok()
is false.

And actually we are. Tested on all the default position injecting
a number from -1000000 to 1000000 casted to a Move.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoChange move_is_ok() and square_is_ok() in something useful
Marco Costalba [Thu, 6 Jan 2011 09:32:27 +0000 (10:32 +0100)]
Change move_is_ok() and square_is_ok() in something useful

As is defined now is always true, tested with:

  for (long i=-1000000; i < 1000000; i++)
      if (!move_is_ok(Move(i)))
          exit(0);

Reason is that move_from() and move_to() already truncate the
input value to something in the range [0, 63] that is always
a possible square.

So change definition to something useful.

The same applies also to square_is_ok()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoImprove update_killers() signature
Marco Costalba [Thu, 6 Jan 2011 08:09:53 +0000 (09:09 +0100)]
Improve update_killers() signature

Will be used by future patches and is cleaner.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix variable naming in prototypes at uci.cpp
Joona Kiiski [Wed, 5 Jan 2011 22:34:51 +0000 (00:34 +0200)]
Fix variable naming in prototypes at uci.cpp

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRemove a false comment
Joona Kiiski [Wed, 5 Jan 2011 22:16:33 +0000 (00:16 +0200)]
Remove a false comment

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSet moveCount base to 1 as in search()
Marco Costalba [Wed, 5 Jan 2011 12:39:31 +0000 (13:39 +0100)]
Set moveCount base to 1 as in search()

Now first move has moveCount == 1 also in root_search()

Also added small readibility touches.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse killers also in root_search()
Marco Costalba [Tue, 4 Jan 2011 10:43:20 +0000 (11:43 +0100)]
Use killers also in root_search()

After 4238 games
Mod-Orig 800 - 686 - 2752 +9 ELO

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoPerft should return an int64_t not an int
Marco Costalba [Wed, 5 Jan 2011 16:03:57 +0000 (17:03 +0100)]
Perft should return an int64_t not an int

Found by Louis Zulli with his super fast
hardware: 65M nodes/sec at perft !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix POPCNT support for Intel compiler under Windows
Marco Costalba [Wed, 5 Jan 2011 10:02:05 +0000 (11:02 +0100)]
Fix POPCNT support for Intel compiler under Windows

Reported by Martin Wyngaarden that also confirmed
this patch to work.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoEsplicitly inline generate_piece_moves() & friends
Marco Costalba [Wed, 5 Jan 2011 08:49:58 +0000 (09:49 +0100)]
Esplicitly inline generate_piece_moves() & friends

Should be already inlined by the compiler when
optimizing but better safe than sorry ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse 'moveCount' name also in RootSearch
Marco Costalba [Tue, 4 Jan 2011 10:35:54 +0000 (11:35 +0100)]
Use 'moveCount' name also in RootSearch

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse -O3 instead of -fast for Linux icc
Marco Costalba [Tue, 4 Jan 2011 10:09:35 +0000 (11:09 +0100)]
Use -O3 instead of -fast for Linux icc

Reported by Heinz and confirmed by Joona to increase
the speed of 6% !

No change for icc on OSX

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoAnother round of bitboard.cpp cleanups
Marco Costalba [Mon, 3 Jan 2011 10:50:41 +0000 (11:50 +0100)]
Another round of bitboard.cpp cleanups

Also renamed StepAttackBB[] in NonSlidingAttacksBB[]

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRestore development version
Marco Costalba [Tue, 4 Jan 2011 08:55:17 +0000 (09:55 +0100)]
Restore development version

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoStockfish 2.0.1
Marco Costalba [Tue, 4 Jan 2011 07:24:05 +0000 (08:24 +0100)]
Stockfish 2.0.1

Always same siganture: 7224363

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUpdate Readme and polyglot files
Marco Costalba [Mon, 3 Jan 2011 22:55:12 +0000 (23:55 +0100)]
Update Readme and polyglot files

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoAnother attempt at fixing Chess960
Marco Costalba [Mon, 3 Jan 2011 11:50:49 +0000 (12:50 +0100)]
Another attempt at fixing Chess960

Keep the isChess960 flag inside Position so that is
copied with the Position, but esplicitly highlight the
fact that a FEN string has not enough information to detect
Chess960 in general case. To do this add a boolean argument
isChess960 to from_fen() function so to self document this
shortcoming of FEN notation.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRevert Chess960 fix
Marco Costalba [Mon, 3 Jan 2011 21:31:17 +0000 (22:31 +0100)]
Revert Chess960 fix

Will be substituted by a better next patch.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoReintroduce the old "trapped bishop in the corner" evaluation term
Tord Romstad [Mon, 3 Jan 2011 21:32:57 +0000 (22:32 +0100)]
Reintroduce the old "trapped bishop in the corner" evaluation term
for Chess960 games.

After 1918 games at 30"
Mod - Orig: 1052-866 (+532,-346,=1040), Elo +33.8

13 years agoUse simple macro to enable operators
Joona Kiiski [Mon, 3 Jan 2011 14:09:38 +0000 (16:09 +0200)]
Use simple macro to enable operators

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoWorkaround broken function-style cast support in HP-UX
Marco Costalba [Mon, 3 Jan 2011 10:36:32 +0000 (11:36 +0100)]
Workaround broken function-style cast support in HP-UX

It seems HP's ANSI C++ doesn't understand very well
standard function-style cast.

Reported by Richard Lloyd.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoReadd SRWLOCK and Condition Variables under Windows
Marco Costalba [Mon, 3 Jan 2011 09:49:33 +0000 (10:49 +0100)]
Readd SRWLOCK and Condition Variables under Windows

And set them as default.

Introduce compile switch OLD_LOCKS to allow to fallback on
compatible locks supported by Windows XP and older versions.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix Chess960 regression
Marco Costalba [Sun, 2 Jan 2011 23:35:05 +0000 (00:35 +0100)]
Fix Chess960 regression

Introduced by me in before 1.9 and found by Tord that says:

The 'isChess960' slot in the 'Position' class is currently
set depending on the initial files of the rooks, and not on the value
of the UCI_Chess960 parameter. This is incorrect, as there are lots of
Chess960 positions where the rooks start on the usual files. As a
consequence (unless I am missing something), Stockfish will occasionally
output castling moves as e1g1/e1c1 rather than the correct e1h1/e1a1 format
in Chess960 games. It is possible that some or even most GUIs are robust
enough to accept both notations, but I wouldn't bet on it. And in any case,
Stockfish's behavior clearly violates the protocol.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoAnother (final?) attempt at squares_delta()
Marco Costalba [Sun, 2 Jan 2011 10:45:03 +0000 (11:45 +0100)]
Another (final?) attempt at squares_delta()

This time I have removed the function alltogether !

Sorry to work above a patch of UncombedCoconut (Justin Blanchard)
but I couldn't resist ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix old Glaurung bug related to search logging
Marco Costalba [Sun, 2 Jan 2011 10:21:37 +0000 (11:21 +0100)]
Fix old Glaurung bug related to search logging

When we log best and ponder move to a file before to
return from think we change the position. If position is
then not resended by GUI, as for manual user input we got
an error:

justinb@malibu:~$ stockfish
Stockfish 2.0 JA 64bit by Tord Romstad, Marco Costalba, Joona Kiiski
setoption name Use Search Log value true
go depth 1
info depth 1
info depth 1 seldepth 1 multipv 1 score cp 72 time 59 nodes 20 nps 338 pv g1f3
info depth 2
info depth 2 seldepth 2 multipv 1 score cp 12 time 59 nodes 44 nps 745 pv g1f3 g8f6
info nodes 84 nps 1423 time 59
bestmove g1f3 ponder g8f6
go depth 1
info depth 1 score mate 0
info nodes 87 nps 0 time 0
bestmove (none) ponder (none)

Bug spotted and fixed by UncombedCoconut.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSimplify squares_delta()
Marco Costalba [Sun, 2 Jan 2011 09:41:05 +0000 (10:41 +0100)]
Simplify squares_delta()

And rename in ray_direction()

Patch from UncombedCoconut.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix a crash on multi-pv
Marco Costalba [Sat, 1 Jan 2011 22:10:37 +0000 (23:10 +0100)]
Fix a crash on multi-pv

Bug reported by Tobias Haspel and fixed by Joona.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRestore development version
Marco Costalba [Sat, 1 Jan 2011 11:28:33 +0000 (12:28 +0100)]
Restore development version

And set "Use Sleeping Threads" to true because it keeps
much more responsive and cool my QUAD during tests :-)

It will be reverted back before to release that's the
reason to bundle it here.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoStockfish 2.0 (take 2)
Marco Costalba [Sat, 1 Jan 2011 15:08:55 +0000 (16:08 +0100)]
Stockfish 2.0 (take 2)

Always same siganture: 7224363

Hopefully some more bug fixed and restored
compatibility with WIndows XP.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoDon't use SRWLOCK and Condition Variables under Windows
Marco Costalba [Sat, 1 Jan 2011 14:49:26 +0000 (15:49 +0100)]
Don't use SRWLOCK and Condition Variables under Windows

They are not compatible with Windows XP

Revert to old CRITICAL_SECTION locks and events.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix an off-by-one bug in sort_multipv()
Marco Costalba [Sat, 1 Jan 2011 14:07:45 +0000 (15:07 +0100)]
Fix an off-by-one bug in sort_multipv()

Second parameter of insertion_sort() is a pointer to the
element _after_ the last of the list, e.g. end() when sorting
all items.

If we want to sort say the first 2 moves we should write:

sort_multipv(2);

So, becuase in root moves loop move counter 'i' starts
from 0, we need to pass:

sort_multipv(i+1);

To sort up to move 'i' included.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRemove artificial Iteration >= 3 constraint on time manager
Marco Costalba [Sat, 1 Jan 2011 13:13:15 +0000 (14:13 +0100)]
Remove artificial Iteration >= 3 constraint on time manager

It doesn't seem to have any meaning.

Also add a FIXME on the MaxNodes condition that now is broken
in SMP case due to known issue with pos.nodes_searched()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix: Honour UCI "quit" command while still in the book
Marco Costalba [Sat, 1 Jan 2011 12:54:44 +0000 (13:54 +0100)]
Fix: Honour UCI "quit" command while still in the book

We were not quitting the engine after a "quit" command
while still in the book and pondering.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSimplify "ponderhit" handling
Marco Costalba [Sat, 1 Jan 2011 12:48:08 +0000 (13:48 +0100)]
Simplify "ponderhit" handling

If flag StopOnPonderhit is set it means that we UseTimeManagement
and also we are at Iteration >= 3.

So we can safely simplify the formula.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire ponderhit()
Marco Costalba [Sat, 1 Jan 2011 12:08:09 +0000 (13:08 +0100)]
Retire ponderhit()

It is called only from one place, so move code there.

Add a bit of renaming and documentation while at there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRestore development version
Marco Costalba [Sat, 1 Jan 2011 11:28:33 +0000 (12:28 +0100)]
Restore development version

And set "Use Sleeping Threads" to true because it keeps
much more responsive and cool my QUAD during tests :-)

It will be reverted back before to release that's the
reason to bundle it here.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoStockfish 2.0
Marco Costalba [Fri, 31 Dec 2010 10:50:05 +0000 (11:50 +0100)]
Stockfish 2.0

stockfish bench signature is: 7224363

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSend correct searched nodes statistic
Marco Costalba [Fri, 31 Dec 2010 17:18:23 +0000 (18:18 +0100)]
Send correct searched nodes statistic

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRemove dubious castle detector
Marco Costalba [Fri, 31 Dec 2010 13:32:25 +0000 (14:32 +0100)]
Remove dubious castle detector

It was introduced by patch 66d16592 of 22/3/2009 merging
from Glarurung iPhone.

Tord says:
That change is only found in the Glaurung iPhone app, and not
in the latest Glaurung UCI source code. I don't remember why
this was added (and the iPhone app, unlike the UCI engine,
was never version controlled), but it was almost certainly
because it was somehow needed in the communication between
the engine and the iPhone GUI, and that it was never meant to be
included in the UCI engine. My guess is that it has something to
do with castling moves being entered as e1-g1 in the GUI, but
represented as e1-h1 in the chess engine.

Removing it in Stockfish should be completely safe, and won't harm
the iPhone version. Initially the iPhone GUI called functions in the
chess engine for checking for legality of moves, writing the move
list in SAN format, and various other tasks, but this is no longer
the case in the current version.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoImplement "seldepth" UCI info
Marco Costalba [Fri, 31 Dec 2010 12:19:05 +0000 (13:19 +0100)]
Implement "seldepth" UCI info

This is the "selective search depth in plies" and we set
equal to PV line length.

Tested that works under FritzGUI.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire a couple of unused debug functions
Marco Costalba [Thu, 30 Dec 2010 15:27:16 +0000 (16:27 +0100)]
Retire a couple of unused debug functions

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoLeave threads go to sleep when waiting for a ponderhit
Marco Costalba [Thu, 30 Dec 2010 15:18:22 +0000 (16:18 +0100)]
Leave threads go to sleep when waiting for a ponderhit

No need to heat up CPU in this case ;-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMove printing of best move on think
Marco Costalba [Thu, 30 Dec 2010 14:45:43 +0000 (15:45 +0100)]
Move printing of best move on think

It seems a more appropiate place (IMHO) and helps to clarify
that idle_loop() should return a move, not a score.

Fix also handling of stalemate positions (we were not
sending any score) and we don't need to wait on "ponderhit",
this is done when returning in think().

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUnify single and multi PV 'new best move' handling
Marco Costalba [Thu, 30 Dec 2010 11:53:02 +0000 (12:53 +0100)]
Unify single and multi PV 'new best move' handling

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMove print_pv_info() under RootMove
Marco Costalba [Thu, 30 Dec 2010 10:55:25 +0000 (11:55 +0100)]
Move print_pv_info() under RootMove

And rename to pv_info_to_uci()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoBetter document value_to_uci()
Marco Costalba [Thu, 30 Dec 2010 10:46:53 +0000 (11:46 +0100)]
Better document value_to_uci()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoStandardize root_search() signature
Marco Costalba [Thu, 30 Dec 2010 09:38:02 +0000 (10:38 +0100)]
Standardize root_search() signature

Now pass alpha and beta by copy as in serach()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMove extract_pv_from_tt() and insert_pv_in_tt() under RootMove
Marco Costalba [Wed, 29 Dec 2010 10:00:32 +0000 (11:00 +0100)]
Move extract_pv_from_tt() and insert_pv_in_tt() under RootMove

Functional change only due to additional do/undo move
but absolutly harmless.

Also handle re-insertion in tt of PV lines also for multi PV case.

13 years agoUse rml[0].pv[] instead of dedicated pv[] array
Marco Costalba [Wed, 29 Dec 2010 07:47:14 +0000 (08:47 +0100)]
Use rml[0].pv[] instead of dedicated pv[] array

We have a small functionality change in case we have a
fail-high so that both rml[].pv and pv[] are updated, but if,
after researching, we have a fail-low then rml score is updated
again but pv[] remains the same and coming back from search we
used a PV line that has failed-low (after having failed-high).

With this patch we always use the 'correct' PV line, i.e. the
line with highest score at the end of the whole search.

Retire also redundant RootMove's 'move' member and directly
use pv[0] instead.

13 years agoLast small touches in RootMoveList
Marco Costalba [Tue, 28 Dec 2010 18:05:24 +0000 (19:05 +0100)]
Last small touches in RootMoveList

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire LMR intermediate research
Marco Costalba [Mon, 20 Dec 2010 15:42:07 +0000 (16:42 +0100)]
Retire LMR intermediate research

It does not seem to improve anything.

After 8344 games Mod - Orig:
1362 - 1321 - 5661 ELO +2

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse insertion_sort() in RootMoveList
Marco Costalba [Tue, 28 Dec 2010 12:29:53 +0000 (13:29 +0100)]
Use insertion_sort() in RootMoveList

Simplify code and get a bit of extra speed, about +0.5%

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRedefine MoveStack comparison as the natural one
Marco Costalba [Tue, 28 Dec 2010 10:45:57 +0000 (11:45 +0100)]
Redefine MoveStack comparison as the natural one

Define symbol '<' to mean 'minor of', as it should be. Its meaning
was reversed to be used with std::sort() that sorts in ascending order
while we want a descending order.

But now that we use our own sorting code we don't need this
trick anymore.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix broken last patch series
Marco Costalba [Tue, 28 Dec 2010 09:16:53 +0000 (10:16 +0100)]
Fix broken last patch series

When a reference breaks things !

Here we take a reference (that is a pointer) to an
entry in a vector that changes below us --> BOOM !

References are essential but should be considered with
care in C++ because could lead to nasty surprises.

Restored functionality.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSpeedup moves root list sorting
Marco Costalba [Mon, 27 Dec 2010 12:29:52 +0000 (13:29 +0100)]
Speedup moves root list sorting

Instead of a default member by member copy use set_pv()
to copy the useful part of pv[] array and skip the remaining.

This greatly speeds up sorting of root move list !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse a std::vector to store root moves
Marco Costalba [Mon, 27 Dec 2010 11:20:26 +0000 (12:20 +0100)]
Use a std::vector to store root moves

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRename RootMoveList members removing 'move'
Marco Costalba [Mon, 27 Dec 2010 09:52:04 +0000 (10:52 +0100)]
Rename RootMoveList members removing 'move'

It is redundant being a move list ;-)

Also better document the two scores used by root list.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire DirectionTable[]
Marco Costalba [Sun, 26 Dec 2010 23:13:10 +0000 (00:13 +0100)]
Retire DirectionTable[]

With this patch even word 'direction' is disappeared !

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire direction.cpp
Marco Costalba [Sun, 26 Dec 2010 15:27:58 +0000 (16:27 +0100)]
Retire direction.cpp

Move the code to bitboard.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire enum Direction
Marco Costalba [Sun, 26 Dec 2010 11:41:30 +0000 (12:41 +0100)]
Retire enum Direction

Use SquareDelta instead

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire SignedDirectionTable[] and RayBB[]
Marco Costalba [Sun, 26 Dec 2010 10:58:48 +0000 (11:58 +0100)]
Retire SignedDirectionTable[] and RayBB[]

Function ray_bb() was used just in one endgame where can
be used squares_in_front_of() instead.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire direction.h
Marco Costalba [Sun, 26 Dec 2010 09:54:45 +0000 (10:54 +0100)]
Retire direction.h

Move all to square.h

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSimplify enum SquareDelta definition
Marco Costalba [Sun, 26 Dec 2010 09:21:48 +0000 (10:21 +0100)]
Simplify enum SquareDelta definition

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUnify MovePicker c'tor call
Marco Costalba [Sat, 25 Dec 2010 17:03:43 +0000 (18:03 +0100)]
Unify MovePicker c'tor call

And use the standard one.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoUse generate_moves() in san.cpp
Marco Costalba [Sat, 25 Dec 2010 10:22:55 +0000 (11:22 +0100)]
Use generate_moves() in san.cpp

Instead of MovePicker and cleanup san.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoIgnore two braindamaged remarks under icc
Marco Costalba [Sat, 25 Dec 2010 07:59:47 +0000 (08:59 +0100)]
Ignore two braindamaged remarks under icc

Remark 1418: external function definition with no prior declaration

and

Remark 1419: external declaration in primary source file

Can be safely ignored because are pure idiocy.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRenamed thread_should_stop() in cutoff_at_splitpoint()
Marco Costalba [Fri, 24 Dec 2010 23:11:53 +0000 (00:11 +0100)]
Renamed thread_should_stop() in cutoff_at_splitpoint()

It is more clear what happened.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSimplify a condition in update of best move
Marco Costalba [Fri, 24 Dec 2010 16:07:00 +0000 (17:07 +0100)]
Simplify a condition in update of best move

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoTriviality in struct PieceLetters
Marco Costalba [Fri, 24 Dec 2010 14:25:11 +0000 (15:25 +0100)]
Triviality in struct PieceLetters

And little touches in search() too.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoBetter clarify how we use TT depth in qsearch
Marco Costalba [Sat, 18 Dec 2010 09:27:24 +0000 (10:27 +0100)]
Better clarify how we use TT depth in qsearch

Namely we use only two types of depth in TT:
DEPTH_QS_CHECKS or DEPTH_QS_NO_CHECKS.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSecond cleanup wave on check_is_useless()
Marco Costalba [Wed, 15 Dec 2010 08:14:01 +0000 (09:14 +0100)]
Second cleanup wave on check_is_useless()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoLet check_is_useless() follow SF coding style
Joona Kiiski [Tue, 14 Dec 2010 13:49:06 +0000 (15:49 +0200)]
Let check_is_useless() follow SF coding style

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFixed a bug in move_from_uci(): En passant captures were not handled
Tord Romstad [Tue, 14 Dec 2010 11:07:37 +0000 (12:07 +0100)]
Fixed a bug in move_from_uci(): En passant captures were not handled
correctly.

13 years agoSelective checks at qsearch
Joona Kiiski [Sun, 12 Dec 2010 09:54:50 +0000 (11:54 +0200)]
Selective checks at qsearch

After 5821 games
Mod- Orig:  1014 - 869 - 3938 ELO +8 (+- 3.6) LOS 97%

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire uci_main_loop()
Marco Costalba [Mon, 13 Dec 2010 10:17:06 +0000 (11:17 +0100)]
Retire uci_main_loop()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoSmall cleanup in uci.cpp
Marco Costalba [Mon, 13 Dec 2010 08:48:12 +0000 (09:48 +0100)]
Small cleanup in uci.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoRetire square_from_string()
Marco Costalba [Thu, 9 Dec 2010 11:10:02 +0000 (12:10 +0100)]
Retire square_from_string()

And rename move_from/to_string() in a more specific
move_from/to_uci() that is a simple coordinate notation.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoMove the last multi-threads globals to ThreadsManager
Marco Costalba [Sun, 12 Dec 2010 11:46:10 +0000 (12:46 +0100)]
Move the last multi-threads globals to ThreadsManager

Also rename ThreadsManager memeber data to be lower case.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFurther reduce sleep lock contention
Marco Costalba [Sun, 12 Dec 2010 10:06:36 +0000 (11:06 +0100)]
Further reduce sleep lock contention

Use one sleep lock per thread insted of a single one shared.

Also renamed WaitLock in SleepLock.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoAllow threads to sleep when available
Marco Costalba [Sun, 7 Nov 2010 22:45:13 +0000 (23:45 +0100)]
Allow threads to sleep when available

By mean of an an UCI option it is possible let the available
threads to sleep, this should help with Hyper Threading although
is not the best solution when number of threads equals number
of available cores.

Option is disabled by default.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoIncrease MAX_THREADS to 16
Marco Costalba [Sat, 4 Dec 2010 08:18:18 +0000 (09:18 +0100)]
Increase MAX_THREADS to 16

No speed regression and no functional change.

After 7826 games Mod- Orig:
1188 - 1230 - 5408 ELO -1 (+- 3.1)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoIncrease PV LMR to SF 1.8 levels
Marco Costalba [Sun, 5 Dec 2010 16:54:35 +0000 (17:54 +0100)]
Increase PV LMR to SF 1.8 levels

Non-PV LMR is left unchanged.

After 8819 games
Mod- Orig:  1442 - 1343 - 6034 ELO +3 (+- 2.9) LOS 86%

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoVarious cleanups in Position's ancillary functions
Marco Costalba [Mon, 6 Dec 2010 09:26:01 +0000 (10:26 +0100)]
Various cleanups in Position's ancillary functions

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoFix a crash due to a broken Book::open()
Marco Costalba [Sat, 4 Dec 2010 20:19:22 +0000 (21:19 +0100)]
Fix a crash due to a broken Book::open()

Bug introduced in 9dcc2aad98b9703

We can be asked to open a non-exsistent file,
in this case we should gracefully handle the
case and silently return instead of exiting.

Bug discovered and bisected down by Joona.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoNew try for unstoppable pawn evaluation
Joona Kiiski [Sat, 13 Nov 2010 16:42:12 +0000 (18:42 +0200)]
New try for unstoppable pawn evaluation

This time we try very hard to avoid false positives.
The obvious downside is that we also miss many true
winning positions.

After 10544 games on RC
Mod- Orig:  1744  - 1646 - 7154 ELO +3 (+- 2.7) LOS 83%

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
13 years agoAllow razoring after a null move
Marco Costalba [Sat, 30 Oct 2010 14:28:33 +0000 (15:28 +0100)]
Allow razoring after a null move

After 8322 games on Russian Cluster
Mod- Orig:  1341 - 1281 - 5700 ELO +2 (+- 3) LOS 75%

Signed-off-by: Marco Costalba <mcostalba@gmail.com>