stockfish
12 years agoUse a union to fast and simply backup info in do_move()
Marco Costalba [Fri, 20 Feb 2009 10:13:19 +0000 (11:13 +0100)]
Use a union to fast and simply backup info in do_move()

This nice union trick let us optimize the speed and
remove the now unuseful backup() and restore() functions.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIn Position backup and restore contiguous data
Marco Costalba [Fri, 20 Feb 2009 09:20:08 +0000 (10:20 +0100)]
In Position backup and restore contiguous data

Give the compiler one more chance to optimize the copy.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFinally remove any occurence of dcCandidates from search.cpp
Marco Costalba [Thu, 19 Feb 2009 16:35:23 +0000 (17:35 +0100)]
Finally remove any occurence of dcCandidates from search.cpp

This ends our cleanup series.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDo not pass discovery check candidates in Position::do_move()
Marco Costalba [Thu, 19 Feb 2009 16:29:36 +0000 (17:29 +0100)]
Do not pass discovery check candidates in Position::do_move()

Also remove any bit of 'pinned' and co. from MovePicker class.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDo not pass pinned argument in Position::move_is_check()
Marco Costalba [Thu, 19 Feb 2009 16:01:08 +0000 (17:01 +0100)]
Do not pass pinned argument in Position::move_is_check()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDo not pass pinned argument in Position::pl_move_is_legal()
Marco Costalba [Thu, 19 Feb 2009 15:48:57 +0000 (16:48 +0100)]
Do not pass pinned argument in Position::pl_move_is_legal()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoCleanup pinned and friends in movegen.cpp
Marco Costalba [Thu, 19 Feb 2009 15:37:03 +0000 (16:37 +0100)]
Cleanup pinned and friends in movegen.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoCache pinned and discovery check bitboards
Marco Costalba [Thu, 19 Feb 2009 15:28:35 +0000 (16:28 +0100)]
Cache pinned and discovery check bitboards

After have been calculated cache their values
so to avoid another expensive call to hidden_checks()
if pinned_pieces() or discovered_check_candidates() are
called with the same position.

Add also interface to get pinners bitboard, we already have
this value so save it instead of discard.

Now that, after the first call to pinned_pieces() the following
are very cheap we can rewrite and cleanup all the checking handling.

So this patch is a prerequisite for future work.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRevert mobility of pinned pieces for now
Marco Costalba [Thu, 19 Feb 2009 14:49:54 +0000 (15:49 +0100)]
Revert mobility of pinned pieces for now
We will redo after rewriting the handling of
pinned bitboard and its friends.

12 years agoRemove xxx_of_color() for real
Marco Costalba [Tue, 17 Feb 2009 16:26:15 +0000 (17:26 +0100)]
Remove xxx_of_color() for real

Remove also from assert expressions. Was hidden
in release mode.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoChange piece_attacks_square() API
Marco Costalba [Tue, 17 Feb 2009 11:00:05 +0000 (12:00 +0100)]
Change piece_attacks_square() API

An extra argument let us simplify some code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMobility is zero for a pinned piece
Marco Costalba [Tue, 17 Feb 2009 10:29:14 +0000 (11:29 +0100)]
Mobility is zero for a pinned piece

A little bit more overhead, but better mobility evaluation.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove xxx_of_color() helpers
Marco Costalba [Tue, 17 Feb 2009 09:54:47 +0000 (10:54 +0100)]
Remove xxx_of_color() helpers

They hide the underlying uniform function call with
no benefit.

A little bit more verbose but now is clear what happens.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAvoid a call to move_is_capture() in extension()
Marco Costalba [Fri, 13 Feb 2009 19:21:05 +0000 (20:21 +0100)]
Avoid a call to move_is_capture() in extension()

Pass value as an argument instead or recalculating it.
Altough call is cheap this is a very hot path so with
this patch total time spent for move_is_capture() is almost
halved.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAdd scan for X-ray attacks in piece_attacks_square()
Marco Costalba [Fri, 13 Feb 2009 14:29:24 +0000 (15:29 +0100)]
Add scan for X-ray attacks in piece_attacks_square()

Used to avoid pruning interesting moves.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix a subtle bug in Position::move_is_capture()
Marco Costalba [Fri, 13 Feb 2009 13:17:39 +0000 (14:17 +0100)]
Fix a subtle bug in Position::move_is_capture()

Currently fails if we test with a move that is not of
from the side to move but from the opponent.

This is the typical case of the threat from null move
search. The result is an erroneus prune of the defending
moves, see PruneDefendingMoves in ok_to_prune()

Fix the test to work also with threat moves.

Bug was always in but was unhidden by a patch of 17/12/2008
"Trigger of PawnEndgameExtension if capture is not a pawn"

Until then it was hidden by a tricky check in the prune
conditions instead of the natural move_is_capture()

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDo not manually build endgame functions hash keys
Marco Costalba [Fri, 13 Feb 2009 09:00:47 +0000 (10:00 +0100)]
Do not manually build endgame functions hash keys

Use Position::compute_material_key() to do the job,
so we are sure there is not key mismatch during
endgame function lookups.

This fixes two endgames hash errors that caused two
endgames to be disabled.

This patch is also a code cleanup because removes a lot
of messy key assignments.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse template for endgame scaling functions
Marco Costalba [Thu, 12 Feb 2009 13:59:46 +0000 (14:59 +0100)]
Use template for endgame scaling functions

Also integrate scaling and evaluation in a
single base class.

Nice use of templates here :-)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse templates for end game evaluation functions
Marco Costalba [Thu, 12 Feb 2009 12:20:22 +0000 (13:20 +0100)]
Use templates for end game evaluation functions

Huge simplification and no speed cost penalty.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSmall code formatting in position.cpp
Marco Costalba [Thu, 12 Feb 2009 11:43:14 +0000 (12:43 +0100)]
Small code formatting in position.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse update_checkers<>() also for PAWN
Marco Costalba [Thu, 12 Feb 2009 11:26:23 +0000 (12:26 +0100)]
Use update_checkers<>() also for PAWN

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIntroduce update_checkers() to simplify do_move()
Marco Costalba [Thu, 12 Feb 2009 11:12:46 +0000 (12:12 +0100)]
Introduce update_checkers() to simplify do_move()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove square_is_attacked()
Marco Costalba [Thu, 12 Feb 2009 08:53:37 +0000 (09:53 +0100)]
Remove square_is_attacked()

Use attacks_to() instead. No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRename generate_piece_blocking_evasions()
Marco Costalba [Thu, 12 Feb 2009 08:28:18 +0000 (09:28 +0100)]
Rename generate_piece_blocking_evasions()

In generate_piece_moves() to be more uniform with other
functions. Unfortunatly the different number of calling arguments
do not allow us to easily integrate in generate_piece_moves()
template family.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFinal touches to generate_evasions()
Marco Costalba [Wed, 11 Feb 2009 16:21:03 +0000 (17:21 +0100)]
Final touches to generate_evasions()

Small code tidy up and a little optimization
to avoid calling generate_piece_blocking_evasions()
when blockSquares is empty (30% of cases).

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSimplify legality check in generate_evasions()
Marco Costalba [Wed, 11 Feb 2009 10:59:27 +0000 (11:59 +0100)]
Simplify legality check in generate_evasions()

Now that we have removed sliders checkers attacks
from evasion's set we can simplyfy legality check.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agogenerate_evasions() avoid an usless check for enpassant case
Marco Costalba [Wed, 11 Feb 2009 15:51:35 +0000 (16:51 +0100)]
generate_evasions() avoid an usless check for enpassant case

Remove ugly and useless code.
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoOptimize generate_piece_blocking_evasions()
Marco Costalba [Wed, 11 Feb 2009 11:58:45 +0000 (12:58 +0100)]
Optimize generate_piece_blocking_evasions()

Rewrite as in generate_piece_moves() using a for
loop instead of the slower serializing of the
bitboard with pop_1st_bit()

This will allow also to merge with generate_piece_moves()
when we will drop legality constrain on generate_evasions()

Generated moves are not changed, but are generated in a
different order, this changes the number of nodes at fixed
depth test.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agogenerate_evasions() avoid to calculate pinned pieces
Marco Costalba [Wed, 11 Feb 2009 11:13:58 +0000 (12:13 +0100)]
generate_evasions() avoid to calculate pinned pieces

Pass as function argument.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDrop a double semicolon
Marco Costalba [Wed, 11 Feb 2009 07:37:33 +0000 (08:37 +0100)]
Drop a double semicolon

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoLast touches to movegen.cpp
Marco Costalba [Tue, 10 Feb 2009 16:53:19 +0000 (17:53 +0100)]
Last touches to movegen.cpp

Of course no functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove special case of pawn checks generation
Marco Costalba [Tue, 10 Feb 2009 16:44:55 +0000 (17:44 +0100)]
Remove special case of pawn checks generation

Also additional renaming.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove special case of pawn move generatation
Marco Costalba [Tue, 10 Feb 2009 16:31:07 +0000 (17:31 +0100)]
Remove special case of pawn move generatation

Code cleanup. No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSimplify generate_evasions()
Marco Costalba [Tue, 10 Feb 2009 15:58:02 +0000 (16:58 +0100)]
Simplify generate_evasions()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSimplify generate_checks()
Marco Costalba [Tue, 10 Feb 2009 15:02:48 +0000 (16:02 +0100)]
Simplify generate_checks()

Also rearrange signatures to be uniform.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMicro-optimize do_generate_pawn_checks()
Marco Costalba [Tue, 10 Feb 2009 11:28:47 +0000 (12:28 +0100)]
Micro-optimize do_generate_pawn_checks()

Discovery check candidates are normally empty, so
avoid discovery checks generation in that common case.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTempletize generate_piece_checks_king()
Marco Costalba [Tue, 10 Feb 2009 10:03:45 +0000 (11:03 +0100)]
Templetize generate_piece_checks_king()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSmall optimization in generate_evasions()
Marco Costalba [Sat, 7 Feb 2009 12:11:52 +0000 (13:11 +0100)]
Small optimization in generate_evasions()

Find squares attacked by slider checkers, we will
remove them from king evasions set so to avoid a couple
of cycles in the slow king evasions legality check loop.

Not a biggie, but now generate_evasions() is faster then
generate_non_captures(), before was slower.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSimplify newly introduced castling_is_check()
Marco Costalba [Fri, 6 Feb 2009 15:40:30 +0000 (16:40 +0100)]
Simplify newly introduced castling_is_check()

Use bit_is_set() instead of open coding.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSmall code style tidy up
Marco Costalba [Fri, 6 Feb 2009 15:21:00 +0000 (16:21 +0100)]
Small code style tidy up

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix casting warnings under Intel Compiler
Marco Costalba [Sat, 7 Feb 2009 11:31:53 +0000 (12:31 +0100)]
Fix casting warnings under Intel Compiler

Int to Char warning fixed changing the function
signature to int.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix Makefile
Marco Costalba [Sat, 7 Feb 2009 11:25:37 +0000 (12:25 +0100)]
Fix Makefile

Was broken after we removed color.cpp and square.cpp

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTempletize generate_castle_moves()
Marco Costalba [Thu, 5 Feb 2009 15:08:00 +0000 (16:08 +0100)]
Templetize generate_castle_moves()

Cleanup the code and remove lines.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAdd generation of castling checks
Marco Costalba [Thu, 5 Feb 2009 14:06:41 +0000 (15:06 +0100)]
Add generation of castling checks

When we generate checks one case is missing: generation
of castling moves that give check to the opponent king.

This is a very rare case but anyway it is a case
and we can do this without slowing down the common
case of no castling checks.

So this is the patch.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove square.cpp
Marco Costalba [Wed, 4 Feb 2009 16:51:23 +0000 (17:51 +0100)]
Remove square.cpp

Move the few stuff in square.h

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMove constants from piece.cpp to piece.h
Marco Costalba [Wed, 4 Feb 2009 16:42:28 +0000 (17:42 +0100)]
Move constants from piece.cpp to piece.h

Leave in piece.cpp only a couple of functions that
need #include <cstring>

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoPawnInfo::clear() retire memset() and fix Ubuntu compile
Marco Costalba [Wed, 4 Feb 2009 16:18:12 +0000 (17:18 +0100)]
PawnInfo::clear() retire memset() and fix Ubuntu compile

Go back to original direct assignment, this allows to
add an include in pawns.h to teach about memset()

This fix a compile error under Ubuntu.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove the useless color.cpp
Marco Costalba [Wed, 4 Feb 2009 16:12:21 +0000 (17:12 +0100)]
Remove the useless color.cpp

Integrate the only (inline) function in color.h

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFinal endgame.cpp space inflate
Marco Costalba [Tue, 3 Feb 2009 15:08:41 +0000 (16:08 +0100)]
Final endgame.cpp space inflate

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRevert previous commit.
Marco Costalba [Tue, 3 Feb 2009 14:41:04 +0000 (15:41 +0100)]
Revert previous commit.
Optimization is correct but slightly slower
so it is a pessimization :-)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoYet another count_1s() optimization
Marco Costalba [Sun, 25 Jan 2009 18:29:15 +0000 (19:29 +0100)]
Yet another count_1s() optimization

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRever count_1s() optimizations
Marco Costalba [Sun, 25 Jan 2009 17:00:57 +0000 (18:00 +0100)]
Rever count_1s() optimizations

They are wrong for all ones case.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMovePicker, remove a variable
Marco Costalba [Sun, 25 Jan 2009 12:52:35 +0000 (13:52 +0100)]
MovePicker, remove a variable

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMovePicker::find_best_index() never returns -1
Marco Costalba [Sun, 25 Jan 2009 12:36:59 +0000 (13:36 +0100)]
MovePicker::find_best_index() never returns -1

So avoid checking for it.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRewrite count_1s() to be similar to 64bit counterpart
Marco Costalba [Sun, 11 Jan 2009 16:15:18 +0000 (17:15 +0100)]
Rewrite count_1s() to be similar to 64bit counterpart

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMicro optimize count_1s_max_15() for 32 bit system
Marco Costalba [Sun, 11 Jan 2009 16:05:29 +0000 (17:05 +0100)]
Micro optimize count_1s_max_15() for 32 bit system

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix a very old bug in queen mobility
Marco Costalba [Sat, 10 Jan 2009 15:11:33 +0000 (16:11 +0100)]
Fix a very old bug in queen mobility

For queen mobility could be bigger then 15, so
we need count_1s() not count_1s_max_15().

This bug was introduced by patch:
"Group common evaluate code" of 24/9/2008

So it's almost 4 months and two release old!

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoStart to space inflate endgame.cpp
Marco Costalba [Thu, 8 Jan 2009 14:46:57 +0000 (15:46 +0100)]
Start to space inflate endgame.cpp

Still a lot to do, it's a big file!

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRewrite evaluate_common() as a template
Marco Costalba [Wed, 7 Jan 2009 14:37:28 +0000 (15:37 +0100)]
Rewrite evaluate_common() as a template

Seems to speed up this very hot path and code is
cleaner too.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoBig trailing whitespace cleanup part 2
Marco Costalba [Wed, 7 Jan 2009 13:28:04 +0000 (14:28 +0100)]
Big trailing whitespace cleanup part 2

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoBig trailing whitespace cleanup part 1
Marco Costalba [Wed, 7 Jan 2009 13:26:58 +0000 (14:26 +0100)]
Big trailing whitespace cleanup part 1

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAnother micro-optmization in valuate_passed_pawns()
Marco Costalba [Wed, 7 Jan 2009 13:17:50 +0000 (14:17 +0100)]
Another micro-optmization in valuate_passed_pawns()

very small gain, but still a gain at the cost of
an extra indentation level.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix a small bug in rook pawn evaluation
Marco Costalba [Tue, 6 Jan 2009 15:10:22 +0000 (16:10 +0100)]
Fix a small bug in rook pawn evaluation

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoevaluate_passed_pawns() micro-optmization
Marco Costalba [Tue, 6 Jan 2009 15:06:08 +0000 (16:06 +0100)]
evaluate_passed_pawns() micro-optmization

No functional change, only a bit faster.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFinal space inflate of evaluatio.cpp
Marco Costalba [Tue, 6 Jan 2009 14:59:08 +0000 (15:59 +0100)]
Final space inflate of evaluatio.cpp

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSpace inflate evaluate_passed_pawns()
Marco Costalba [Tue, 6 Jan 2009 14:49:33 +0000 (15:49 +0100)]
Space inflate evaluate_passed_pawns()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoPiece mobility: filter out squares protected by pawns
Marco Costalba [Mon, 5 Jan 2009 14:14:16 +0000 (15:14 +0100)]
Piece mobility: filter out squares protected by pawns

Do not consider squares protected by enemy pawns
in mobility evaluation.

This reduces the mobility value by about 15%

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTake in account odd depths in razoring formula
Marco Costalba [Mon, 5 Jan 2009 11:41:27 +0000 (12:41 +0100)]
Take in account odd depths in razoring formula

This is somewhat taken from Stockfish 1.2 Default,
only the razoring thresold are updated, not the
razoring depth.

At the end razoring is a bit more aggressive. Results
seems slightly positive.

After 999 games +239 =536 -224 Elo +5

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix dbg_mean_of() to enable statistics when called
Marco Costalba [Tue, 30 Dec 2008 11:54:21 +0000 (12:54 +0100)]
Fix dbg_mean_of() to enable statistics when called

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRestore development versioning and LSN filtering
Marco Costalba [Tue, 30 Dec 2008 11:42:23 +0000 (12:42 +0100)]
Restore development versioning and LSN filtering

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoStockfish 1.2 optimistic
Marco Costalba [Mon, 29 Dec 2008 11:24:34 +0000 (12:24 +0100)]
Stockfish 1.2 optimistic

Optimistic razoring settings. It is stronger with
most engines but weaker with someones.

The default is instead more solid and uniform with all
the opponents.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoStockfish 1.2
Marco Costalba [Mon, 29 Dec 2008 11:06:21 +0000 (12:06 +0100)]
Stockfish 1.2

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMicro optimization in extension()
Marco Costalba [Mon, 29 Dec 2008 10:57:07 +0000 (11:57 +0100)]
Micro optimization in extension()

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove a gcc warning on an unused variable
Marco Costalba [Mon, 29 Dec 2008 10:36:11 +0000 (11:36 +0100)]
Remove a gcc warning on an unused variable

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoProperly handle odd depths in razor formula
Marco Costalba [Sun, 28 Dec 2008 18:38:44 +0000 (19:38 +0100)]
Properly handle odd depths in razor formula

A little bit more aggressive, but should be more
in line with the depths logic.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSafer razoring formula
Marco Costalba [Sun, 28 Dec 2008 11:55:33 +0000 (12:55 +0100)]
Safer razoring formula

Add also the possibility to razor at ply one.
It is disable dby default but it seems stronger
against Stockfish itself. It is still not clear if
is stronger against other engines. By now leave
disabled.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDon't silently accept an option name mismatch
Marco Costalba [Sun, 28 Dec 2008 11:37:13 +0000 (12:37 +0100)]
Don't silently accept an option name mismatch

With this we could have found earlier the futility
name option bug!

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTweak again futility margings
Marco Costalba [Thu, 25 Dec 2008 19:08:45 +0000 (20:08 +0100)]
Tweak again futility margings

Lower margins near the leafs, higher at high depth.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoExpose new futility margin interface to UCI
Marco Costalba [Thu, 25 Dec 2008 18:41:24 +0000 (19:41 +0100)]
Expose new futility margin interface to UCI

Now futility margin it's actually a scale factor
to apply to the base ones.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTweak futility margins
Marco Costalba [Thu, 25 Dec 2008 11:05:45 +0000 (12:05 +0100)]
Tweak futility margins

Less prune at the bottom and at the middle, a bit more
at the top.

After 747 games: +215 =345 -187 +13 elo

Also introduced a vector of margins, now that start to be a lot
it is a more flexible solution.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTry razoring only for depth > OnePly
Marco Costalba [Wed, 24 Dec 2008 10:27:07 +0000 (11:27 +0100)]
Try razoring only for depth > OnePly

Because razoring verification after qsearch() cuts more
then 40% of candidates, do not waste a costly qsearch for
nodes at depth one that will be probably discarded anyway
by futility.

Also tight razoring conditions to keep dangerous false
negatives below 0,05%. Still not clear if it is enough.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFutility pruning till ply 6 included
Marco Costalba [Wed, 24 Dec 2008 08:34:09 +0000 (09:34 +0100)]
Futility pruning till ply 6 included

Seems good:

After 796 games: +211 = 393 -192 +8 elo

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix a comment
Marco Costalba [Mon, 22 Dec 2008 09:18:36 +0000 (10:18 +0100)]
Fix a comment

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMerge futility pruning from Glaurung 2.2
Marco Costalba [Tue, 23 Dec 2008 11:01:48 +0000 (12:01 +0100)]
Merge futility pruning from Glaurung 2.2

It seems much more powerful then previous one.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoPassed pawns: consider enemy rooks or queens from behind
Marco Costalba [Mon, 22 Dec 2008 11:10:15 +0000 (12:10 +0100)]
Passed pawns: consider enemy rooks or queens from behind

Merged from Glaurung 2.2

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoKing safety: retire rook contact check
Marco Costalba [Mon, 22 Dec 2008 11:07:00 +0000 (12:07 +0100)]
King safety: retire rook contact check

Merged from Glaurung 2.2

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSet the 'Problem' variable only at ply == 1
Marco Costalba [Mon, 22 Dec 2008 10:44:00 +0000 (11:44 +0100)]
Set the 'Problem' variable only at ply == 1

Bug fix merged from Glaurung 2.2 for search_pv()

Added the same fix also to sp_search_pv() where
was missing.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire EvaluatePawnStorms and UseEasyMove constants
Marco Costalba [Sun, 21 Dec 2008 19:10:20 +0000 (20:10 +0100)]
Retire EvaluatePawnStorms and UseEasyMove constants

Merged from Glaurung 2.2

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMerge cosmetics from Glaurung 2.2
Marco Costalba [Sun, 21 Dec 2008 16:02:34 +0000 (17:02 +0100)]
Merge cosmetics from Glaurung 2.2

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMerge space weigth evaluation fromGlaurung 2.2
Marco Costalba [Sun, 21 Dec 2008 15:26:36 +0000 (16:26 +0100)]
Merge space weigth evaluation fromGlaurung 2.2

Is a new evaluation rule that gives bonus in midgame
to the side that has more space behind pawns for its
minor pieces.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMerged two new endgames from Glaurung 2.2
Marco Costalba [Sun, 21 Dec 2008 14:38:10 +0000 (15:38 +0100)]
Merged two new endgames from Glaurung 2.2

It is two bishop against a knight and two minor
pieces against one minor piece.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSEE: add support for enpassant moves
Marco Costalba [Sun, 21 Dec 2008 07:29:46 +0000 (08:29 +0100)]
SEE: add support for enpassant moves

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoCall poll() before to check for stopped search
Marco Costalba [Fri, 19 Dec 2008 09:47:40 +0000 (10:47 +0100)]
Call poll() before to check for stopped search

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoLess aggressive razoring
Marco Costalba [Sun, 21 Dec 2008 09:42:39 +0000 (10:42 +0100)]
Less aggressive razoring

Use a margin to compare with beta so that positions
that after the verifying qsearch have gained a lot of points
are not discarded just becasue not above beta.

Also remove the second condition on depth <= OnePly, it
was too risky and added only a 2% more of pruned nodes.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRevert: "Do not razor when in check"
Marco Costalba [Thu, 18 Dec 2008 21:01:56 +0000 (22:01 +0100)]
Revert: "Do not razor when in check"

It is slightly weaker after 500 games. Keep the
check on mate values.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTrigger of PawnEndgameExtension if capture is not a pawn
Marco Costalba [Wed, 17 Dec 2008 18:36:51 +0000 (19:36 +0100)]
Trigger of PawnEndgameExtension if capture is not a pawn

Instead of a rook.

This gives an unexpected graeat increase!

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agosearch_pv: an enpassant move is a capture
Marco Costalba [Tue, 16 Dec 2008 16:09:19 +0000 (17:09 +0100)]
search_pv: an enpassant move is a capture

Fix the logic in search_pv and sp_search_pv

An additional issue to consider is that a castle move
is not a capture but destination square is not empty.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoqsearch: take in account enpassant in futility formula
Marco Costalba [Tue, 16 Dec 2008 15:30:31 +0000 (16:30 +0100)]
qsearch: take in account enpassant in futility formula

Should not change anything at ELO level but it is
the correct thing to do.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoqsearch: do not call evaluate when in check
Marco Costalba [Tue, 16 Dec 2008 11:55:44 +0000 (12:55 +0100)]
qsearch: do not call evaluate when in check

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRestore development versioning and LSN filtering
Marco Costalba [Mon, 15 Dec 2008 21:23:03 +0000 (22:23 +0100)]
Restore development versioning and LSN filtering

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