]> git.sesse.net Git - stockfish/log
stockfish
12 years agoSimplified discovered check connected_moves()
Marco Costalba [Sat, 16 Jul 2011 08:36:03 +0000 (09:36 +0100)]
Simplified discovered check connected_moves()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSimplify and micro-optimize hidden_checkers()
Marco Costalba [Fri, 15 Jul 2011 21:24:18 +0000 (22:24 +0100)]
Simplify and micro-optimize hidden_checkers()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoNo need to declare default Position c'tor
Marco Costalba [Fri, 15 Jul 2011 20:51:19 +0000 (21:51 +0100)]
No need to declare default Position c'tor

Pointed out by Rein Halbersma.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix a warning under MSVC
Marco Costalba [Fri, 15 Jul 2011 11:20:31 +0000 (12:20 +0100)]
Fix a warning under MSVC

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix parametrized direction in pawns generation
Marco Costalba [Fri, 15 Jul 2011 09:40:09 +0000 (11:40 +0200)]
Fix parametrized direction in pawns generation

It worked by accident because we always called both directions,
but definition was wrong.

Functional change due to different generation order, but
perft numbers are the correct ones.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoCleanup handling of Delta enums
Marco Costalba [Fri, 15 Jul 2011 09:19:49 +0000 (11:19 +0200)]
Cleanup handling of Delta enums

Ispired by Rein's code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse std library to sort moves
Marco Costalba [Thu, 14 Jul 2011 11:12:49 +0000 (12:12 +0100)]
Use std library to sort moves

Functional change due to the fact that now pick_best() is
stable, but should be no change in strenght.

Example code and ideas by Rein Halbersma.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix icc's "unreachable code" warning
Marco Costalba [Mon, 11 Jul 2011 10:17:50 +0000 (11:17 +0100)]
Fix icc's "unreachable code" warning

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTeach to_fen() about Halfmove and Fullmove number
Marco Costalba [Sun, 3 Jul 2011 10:32:34 +0000 (11:32 +0100)]
Teach to_fen() about Halfmove and Fullmove number

And also fix the last '/' at the end of the piece placement field.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse MoveList also in Position::move_is_pl_slow()
Marco Costalba [Sun, 3 Jul 2011 09:38:20 +0000 (10:38 +0100)]
Use MoveList also in Position::move_is_pl_slow()

And rename it in Position::move_is_legal()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire move_is_short_castle() and move_is_long_castle()
Marco Costalba [Sun, 3 Jul 2011 09:08:09 +0000 (10:08 +0100)]
Retire move_is_short_castle() and move_is_long_castle()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRestore startpos_ply_counter() instead of full_moves()
Marco Costalba [Sat, 2 Jul 2011 15:15:20 +0000 (16:15 +0100)]
Restore startpos_ply_counter() instead of full_moves()

And pass correct currentPly to TimeManager::init().

This restores old behaviour, in particular now black has
a different timing than white becuase is no more:

currentPly = 2 * fullMoveNumber;

but becomes

2 * (fullMoves - 1) + int(sideToMove == BLACK)

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIntroduce and use struct MoveList
Marco Costalba [Sat, 2 Jul 2011 12:33:06 +0000 (13:33 +0100)]
Introduce and use struct MoveList

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove MSVC debug window hack in bench
Marco Costalba [Sat, 2 Jul 2011 10:52:22 +0000 (11:52 +0100)]
Remove MSVC debug window hack in bench

Interference with profile-build under mingw

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRearrange structs to avoid internal padding
Marco Costalba [Sat, 2 Jul 2011 10:01:12 +0000 (11:01 +0100)]
Rearrange structs to avoid internal padding

Found with gcc -Wpadded gcc option.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRevert PHQ-2
Marco Costalba [Sat, 2 Jul 2011 08:45:41 +0000 (09:45 +0100)]
Revert PHQ-2

No clear advantage again standard, possibly we will
retest before to release.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSmall touches to do/undo_castle_move()
Marco Costalba [Thu, 30 Jun 2011 14:28:58 +0000 (16:28 +0200)]
Small touches to do/undo_castle_move()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoBetter document generate_castle_moves()
Marco Costalba [Thu, 30 Jun 2011 08:29:58 +0000 (10:29 +0200)]
Better document generate_castle_moves()

No functional change also in Chess960

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSmall tweaks to search()
Marco Costalba [Sat, 25 Jun 2011 13:31:57 +0000 (14:31 +0100)]
Small tweaks to search()

No functional change also in faked split mode

To be sure verified in real games with 4 threads TC 2"+0.1
After 11125 games 2497 - 2469 - 6159 ELO +0 (+- 4.4)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove duplicated enum Phase definition
Marco Costalba [Wed, 29 Jun 2011 16:40:33 +0000 (17:40 +0100)]
Remove duplicated enum Phase definition

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire find_checkers()
Marco Costalba [Tue, 28 Jun 2011 17:01:51 +0000 (18:01 +0100)]
Retire find_checkers()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire square_is_weak()
Marco Costalba [Tue, 28 Jun 2011 14:25:44 +0000 (16:25 +0200)]
Retire square_is_weak()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire one piece_list() overload
Marco Costalba [Tue, 28 Jun 2011 14:16:43 +0000 (16:16 +0200)]
Retire one piece_list() overload

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRename pieces_of_color() in pieces()
Marco Costalba [Tue, 28 Jun 2011 13:36:39 +0000 (15:36 +0200)]
Rename pieces_of_color() in pieces()

To be uniform with other overloads.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire redundant square_is_occupied()
Marco Costalba [Tue, 28 Jun 2011 13:29:58 +0000 (15:29 +0200)]
Retire redundant square_is_occupied()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoChange Position::pst() signature
Marco Costalba [Tue, 28 Jun 2011 12:59:33 +0000 (14:59 +0200)]
Change Position::pst() signature

To be more clear what is the underlying table.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix Shredder-FEN regression in from_fen()
Marco Costalba [Tue, 28 Jun 2011 07:35:51 +0000 (09:35 +0200)]
Fix Shredder-FEN regression in from_fen()

Fix also an incredible 3% speed regression by an almost
never called function. I guess this is due to mingw very low
quality standard libraries implementation.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoGreatly simplify castling rights handling
Marco Costalba [Mon, 27 Jun 2011 15:06:15 +0000 (16:06 +0100)]
Greatly simplify castling rights handling

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAssume input FEN string is correct in from_fen()
Marco Costalba [Mon, 27 Jun 2011 09:07:57 +0000 (10:07 +0100)]
Assume input FEN string is correct in from_fen()

And also tolerate a 0 value for full move number.

Revert BUG_41 patch, now we set initial King file only
if a castling is possible, so we don't need the fix
anymore in case of correct FEN.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix a bug in Position::is_ok()
Marco Costalba [Sun, 26 Jun 2011 10:42:58 +0000 (11:42 +0100)]
Fix a bug in Position::is_ok()

If we cannot castle castleRightsMask[] could be not valid,
for instance when king initial file is FILE_A as queen rook.

In this case castleRightsMask[] at initialQRFile is different
from the expected (ALL_CASTLES ^ WHITE_OOO).

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRename type_of_piece() and color_of_piece()
Marco Costalba [Sun, 26 Jun 2011 09:52:42 +0000 (10:52 +0100)]
Rename type_of_piece() and color_of_piece()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire Position::color_of_piece_on()
Marco Costalba [Sun, 26 Jun 2011 09:37:13 +0000 (10:37 +0100)]
Retire Position::color_of_piece_on()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire Position::type_of_piece_on()
Marco Costalba [Sun, 26 Jun 2011 09:28:54 +0000 (10:28 +0100)]
Retire Position::type_of_piece_on()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire seeValues[] and move PieceValue[] out of Position
Marco Costalba [Sun, 26 Jun 2011 09:16:31 +0000 (10:16 +0100)]
Retire seeValues[] and move PieceValue[] out of Position

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRestore user weights to 100
Marco Costalba [Fri, 24 Jun 2011 09:22:26 +0000 (10:22 +0100)]
Restore user weights to 100

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoPHQ settings for King and Mobility
Marco Costalba [Sat, 18 Jun 2011 22:48:42 +0000 (23:48 +0100)]
PHQ settings for King and Mobility

See:
http://talkchess.com/forum/viewtopic.php?t=39327

After 8130 games on QUAD at 20"+0.1
1342 - 1359 - 5429 ELO +0 (+- 4.4)

Tried also version with just king settings changed:
After 5932 games 962 - 1052 - 3918 ELO -5 (+- 5.2)

And with just mobility settings changed:
After 4114 games 618 - 619  - 2877 ELO +0 (+- 5.9)

Frank has tested only 1200 games, but at longer TC and
against many engines, so because PHQ results are not worst
than other combination and not worst than original let's
commit his version.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix move_is_capture() to detect capture promotions
Marco Costalba [Wed, 22 Jun 2011 22:04:57 +0000 (23:04 +0100)]
Fix move_is_capture() to detect capture promotions

We miss to account as a capture a promotion capture !

Incredible bug in this critical function that is here
since a long time (b50921fd5c3e1753 of 21/10/2009 !!)

This patch fixes the bug and readds the faster
move_is_capture_or_promotion() that slightly increases
overall speed.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRewrite how uci info is sent to GUI
Marco Costalba [Wed, 22 Jun 2011 06:03:28 +0000 (07:03 +0100)]
Rewrite how uci info is sent to GUI

It is now much more modular than before and also we
always send the seldepth when we send the depth, this
avoids to make seldepth disappearing from GUI at the
start of a new iteration.

Print also fails high/low pv lines at high enough
search depths.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSimplify sliding_attacks()
Marco Costalba [Tue, 21 Jun 2011 17:48:14 +0000 (18:48 +0100)]
Simplify sliding_attacks()

Easy, almost trivial simplification, I don't understand
how I missed this before !!

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire ksq from CheckInfo
Marco Costalba [Tue, 21 Jun 2011 06:52:35 +0000 (08:52 +0200)]
Retire ksq from CheckInfo

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse CheckInfo to store pinned bitboard
Marco Costalba [Mon, 20 Jun 2011 07:46:31 +0000 (09:46 +0200)]
Use CheckInfo to store pinned bitboard

This trivial change gives an impressive 2,5% speedup !!!!

Also retire one unused move_gives_check() overload.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoOmit mate distance pruning at root
Marco Costalba [Sat, 18 Jun 2011 16:10:29 +0000 (17:10 +0100)]
Omit mate distance pruning at root

Restore original behaviour, before root unification and
remove a now useless ugly hack for alpha in multi-pv case.

No functional change

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse an array index instead of an iterator in root list
Marco Costalba [Sat, 18 Jun 2011 06:43:25 +0000 (07:43 +0100)]
Use an array index instead of an iterator in root list

It is not correct to use an iterator stick on a vector that
is sorted becuase iterator is invalidated in general case.

It happens to work by accident because iterators are implemented
as pointers and so they behave in the same (correct) way then
using array indices, but the latters are the correct thing to use.

Also better document the code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove useless bestValue = alpha assignement
Marco Costalba [Wed, 15 Jun 2011 11:31:27 +0000 (12:31 +0100)]
Remove useless bestValue = alpha assignement

It is a fossil from the root_search() era, no more
needed today.

Spotted by Onno

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTry only recaptures in qsearch if depth is very low
Marco Costalba [Sun, 12 Jun 2011 06:25:51 +0000 (07:25 +0100)]
Try only recaptures in qsearch if depth is very low

This avoids search explosion in qsearch for some
patological cases like:

r1n1n1b1/1P1P1P1P/1N1N1N2/2RnQrRq/2pKp3/3BNQbQ/k7/4Bq2 w - - 0 1

After 9078 games 20"+0.1 QUAD:
Mod vs Orig 1413 - 1319 - 6346 ELO +3 (+- 4)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSpeed up kpk initialization
Marco Costalba [Wed, 15 Jun 2011 07:09:04 +0000 (09:09 +0200)]
Speed up kpk initialization

The trick is to classify more position at first cycle,
so to reduce following work. Speed up is of about 50% !

Also some cleanup while there.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse Carry-Rippler trick to speed up magics
Marco Costalba [Tue, 14 Jun 2011 17:40:52 +0000 (18:40 +0100)]
Use Carry-Rippler trick to speed up magics

Nice trick discovered on:

http://chessprogramming.wikispaces.com/Traversing+Subsets+of+a+Set

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire init_piece_square_tables()
Marco Costalba [Mon, 13 Jun 2011 14:59:03 +0000 (16:59 +0200)]
Retire init_piece_square_tables()

Merge in init_zobrist() and rename the latter.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIncrease LMR limit by one ply
Marco Costalba [Thu, 2 Jun 2011 07:35:35 +0000 (08:35 +0100)]
Increase LMR limit by one ply

Seems there is no regression so prefer to prune less.

After 8278 games
Mod vs Orig 1246 - 1265 - 5767 +0 ELO (+- 4.2)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoBetter self-document init_zobrist()
Marco Costalba [Sun, 12 Jun 2011 10:46:24 +0000 (11:46 +0100)]
Better self-document init_zobrist()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix initialization of BSFTable[]
Marco Costalba [Sun, 12 Jun 2011 09:49:34 +0000 (10:49 +0100)]
Fix initialization of BSFTable[]

We should start from i = 0, it works by accident because
static storage BSFTable[] is init to zero by default.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDon't update_gains() in qsearch
Marco Costalba [Sun, 12 Jun 2011 06:09:30 +0000 (07:09 +0100)]
Don't update_gains() in qsearch

Is almost unuseful becuase captures are skipped.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix score_captures() for the case of capture promotions
Marco Costalba [Sat, 11 Jun 2011 21:11:17 +0000 (22:11 +0100)]
Fix score_captures() for the case of capture promotions

In case we have more than one promotion move, prefer
the one that captures the biggest piece.

Almost no functional change, anyhow I don't expect any
ELO change, it is just the correct thing to do.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire some unused functions
Marco Costalba [Sat, 11 Jun 2011 14:50:14 +0000 (15:50 +0100)]
Retire some unused functions

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMicro-optimize castling handling in do_move()
Marco Costalba [Sat, 11 Jun 2011 11:41:20 +0000 (12:41 +0100)]
Micro-optimize castling handling in do_move()

And better self-document the code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire PieceLetters struct
Marco Costalba [Fri, 10 Jun 2011 13:50:39 +0000 (15:50 +0200)]
Retire PieceLetters struct

Use a much simpler std::string instead.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoBetter document move_to_san()
Marco Costalba [Fri, 10 Jun 2011 06:49:12 +0000 (08:49 +0200)]
Better document move_to_san()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRevert refinedValue in ProbCut
Marco Costalba [Thu, 9 Jun 2011 20:57:42 +0000 (21:57 +0100)]
Revert refinedValue in ProbCut

It seems much worst in number of nodes seacrhed to reach
the depth and anyhow does not give any advantage to the
Onno's oroginal one.

So revert by now and perhaps readd when we find something
clearly better.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse double rotate for magic generation
Marco Costalba [Thu, 9 Jun 2011 17:09:19 +0000 (18:09 +0100)]
Use double rotate for magic generation

Allow to choose among 4096 instances of pseudo-random
sequences instead of the previous 64 so the probability
to find a better sequence increases and actually we have
a much better 64 bit case and we can also use the 64 bit
version of pick_magic() also for 32 bits and althoug sub
optimal, because now we can have more choices results are
even slightly better also for 32 bit.

Use also a faster submask().

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse refinedValue in ProbCut condition
Marco Costalba [Wed, 8 Jun 2011 17:03:26 +0000 (18:03 +0100)]
Use refinedValue in ProbCut condition

After 12613 games at 20"+0.1 on QUAD
Mod vs Orig 1870 - 1863 - 8880 ELO +0 (+- 3.3)

So no performance change but it is a code semplification
and also is more easy to understand.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSmall pick_magic() touches
Marco Costalba [Wed, 8 Jun 2011 06:04:13 +0000 (07:04 +0100)]
Small pick_magic() touches

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFind magics on the fly
Marco Costalba [Tue, 7 Jun 2011 13:12:07 +0000 (15:12 +0200)]
Find magics on the fly

Good result for 32 bit case where computation is very fast,
still not satisfying on 64 bit case where the magics seem
a bit harder to get.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoPartially revert previous patches
Marco Costalba [Mon, 6 Jun 2011 07:58:59 +0000 (09:58 +0200)]
Partially revert previous patches

Due to a -2% speed penalty. This patch takes the best
of the previous series without the regression due to
introduction of Magic struct.

Speedup against previous revision is of almost 3% !!!!

No functional change both in 32 and 64 bits.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSkip offset calculation in slider attacks
Marco Costalba [Sun, 5 Jun 2011 13:41:59 +0000 (14:41 +0100)]
Skip offset calculation in slider attacks

Another small simplification and micro optimization.

No functional change in both 32 and 64 bits.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoGet rid of Shift[] tables
Marco Costalba [Sun, 5 Jun 2011 11:09:55 +0000 (12:09 +0100)]
Get rid of Shift[] tables

We can calculate them counting the masks bits.

Also small tweak to sliding_attacks()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoBetter name and document magic botboard stuff
Marco Costalba [Sun, 5 Jun 2011 08:04:57 +0000 (09:04 +0100)]
Better name and document magic botboard stuff

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTry to keep memory access in the same cache line
Marco Costalba [Sat, 4 Jun 2011 15:36:52 +0000 (16:36 +0100)]
Try to keep memory access in the same cache line

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSkip draw by repetition check in qsearch
Marco Costalba [Sat, 4 Jun 2011 10:29:54 +0000 (11:29 +0100)]
Skip draw by repetition check in qsearch

Cut in half the time spent in pos.draw() that accounts
for a whopping 1% of total time !

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMove bitboards initializations under one function
Marco Costalba [Sat, 4 Jun 2011 09:16:44 +0000 (10:16 +0100)]
Move bitboards initializations under one function

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoCalculate Bit Scan tables at initialization
Marco Costalba [Sat, 4 Jun 2011 07:54:57 +0000 (08:54 +0100)]
Calculate Bit Scan tables at initialization

Instead of hard-coding them.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoDo not sort negative non captures at low depth
Marco Costalba [Sat, 4 Jun 2011 05:25:16 +0000 (06:25 +0100)]
Do not sort negative non captures at low depth

Speedup of the whole 3 patch series is of 2,5% !!

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoSplit non capture in two sets when ordering
Marco Costalba [Fri, 3 Jun 2011 21:10:23 +0000 (22:10 +0100)]
Split non capture in two sets when ordering

But keep same ordering. This patch is prerequisite
for future work.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoInline extension()
Marco Costalba [Fri, 3 Jun 2011 12:13:28 +0000 (13:13 +0100)]
Inline extension()

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUse TT also in Root nodes
Marco Costalba [Fri, 3 Jun 2011 11:34:51 +0000 (12:34 +0100)]
Use TT also in Root nodes

And other small stuff ti be tested in SMP

No functional change in single thread.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMicrooptimize generate<MV_EVASION>
Marco Costalba [Thu, 2 Jun 2011 11:14:44 +0000 (12:14 +0100)]
Microoptimize generate<MV_EVASION>

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoNew extended probcut implementation
Marco Costalba [Sat, 21 May 2011 16:17:11 +0000 (17:17 +0100)]
New extended probcut implementation

Here the idea is to test probcut not only after bad
captures, but after any bad move, i.e. any move that
leaves the opponent with a good capture.

Ported by a patch from Onno, the difference from
original version is that we have moved probcut after
null search.

After 7917 games 4 threads 20"+0.1
Mod vs Orig: 1261 - 1095 - 5561 ELO +7 (+- 4.2) LOS 96%

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix SAN disambiguation bug
Marco Costalba [Sun, 29 May 2011 09:47:13 +0000 (10:47 +0100)]
Fix SAN disambiguation bug

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRename PH_TT_MOVES in PH_TT_MOVE
Marco Costalba [Sun, 29 May 2011 08:17:03 +0000 (09:17 +0100)]
Rename PH_TT_MOVES in PH_TT_MOVE

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire mateKiller
Marco Costalba [Wed, 25 May 2011 20:36:16 +0000 (21:36 +0100)]
Retire mateKiller

Practically useless:
After 6456 games 1281 - 1293 - 3882 ELO +0 (+- 5.5)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUnify MovePickerExt template parameters
Marco Costalba [Sat, 28 May 2011 11:57:36 +0000 (12:57 +0100)]
Unify MovePickerExt template parameters

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoUnify search() template parameters
Marco Costalba [Sat, 28 May 2011 11:13:42 +0000 (12:13 +0100)]
Unify search() template parameters

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix moveCount after legality check delay
Marco Costalba [Sat, 28 May 2011 09:35:52 +0000 (10:35 +0100)]
Fix moveCount after legality check delay

We really want PV moves and also Split Point moves to be
legal to avoid messing the move counter and corresonding
PV move detection or shared Split Point's counter variable.

This fixes a real bug where a position with only one move
allowed returns bestValue == -VALUE_INFINITE if the move
turns out to be illegal.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoA bit of reformatting after previous series
Marco Costalba [Tue, 24 May 2011 07:07:20 +0000 (09:07 +0200)]
A bit of reformatting after previous series

And some documentation update.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoTest for legality only after futility pruning
Marco Costalba [Mon, 23 May 2011 13:14:47 +0000 (15:14 +0200)]
Test for legality only after futility pruning

Although there is a small functional change it seems
an improvment of about 2% in speed !

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMove legal check out of MovePicker
Marco Costalba [Mon, 23 May 2011 12:58:07 +0000 (14:58 +0200)]
Move legal check out of MovePicker

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRename move_is_legal() in move_is_pl()
Marco Costalba [Mon, 23 May 2011 10:04:59 +0000 (12:04 +0200)]
Rename move_is_legal() in move_is_pl()

We disjoint pseudo legal detection from full legal detection.

It will be used by future patches.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoOutput debug info to cerr
Marco Costalba [Mon, 23 May 2011 14:37:54 +0000 (16:37 +0200)]
Output debug info to cerr

So to be clearly visible when redirecting stdout to /dev/null

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix a shadowed variable warning under gcc
Marco Costalba [Mon, 23 May 2011 08:18:26 +0000 (10:18 +0200)]
Fix a shadowed variable warning under gcc

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoBug wrong evasion detection for king moves
Marco Costalba [Sun, 22 May 2011 09:57:06 +0000 (10:57 +0100)]
Bug wrong evasion detection for king moves

When we are in check and we move the king then testing with
pl_move_is_legal(m, pinned) is not enough becuase we cannot
rely on attackers_to() but we have to explicitly remove the
king form the occupied bitboard to catch as invalid moves like
b1a1 when opposite queen is on c1.

Our move generator already produces correct evasions so we
just need to add the extra verification to move_is_legal().

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoAdd file distance condition in move_is_legal()
Marco Costalba [Sun, 22 May 2011 08:35:34 +0000 (09:35 +0100)]
Add file distance condition in move_is_legal()

Found another missed control in move_is_legal() thanks to
brute force testing.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRemove useless casts in types.h
Marco Costalba [Sun, 22 May 2011 07:52:39 +0000 (08:52 +0100)]
Remove useless casts in types.h

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoPromotion piece must be empty if is not a promotion
Marco Costalba [Sun, 22 May 2011 07:35:14 +0000 (08:35 +0100)]
Promotion piece must be empty if is not a promotion

Add a new check in  move_is_legal()

Avoid useless casting in move.h while there.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoIntroduce MovePicker::isBadCapture() and use in probcut
Marco Costalba [Sat, 21 May 2011 09:40:36 +0000 (10:40 +0100)]
Introduce MovePicker::isBadCapture() and use in probcut

Small functional change due to the fact that now we skip
probcut on evasions.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoCorrectly handle castle in see()
Marco Costalba [Fri, 20 May 2011 05:57:20 +0000 (06:57 +0100)]
Correctly handle castle in see()

Suggested by Onno.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix brekage from previous patches
Marco Costalba [Wed, 18 May 2011 05:46:08 +0000 (06:46 +0100)]
Fix brekage from previous patches

It is interesting the fact that we need to test for
move_is_castle(m) anyway and not relying on testing
if destination square is attacked. Indeed the latter
condition fails if the castling rook is attacked,
castling is coded as "king captures the rook" but it
is legal in that case.

Verified no functional change with beginning of the series.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoMicro-optimize pl_move_is_legal()
Marco Costalba [Tue, 17 May 2011 22:44:55 +0000 (23:44 +0100)]
Micro-optimize pl_move_is_legal()

Remove the check for castling moves because it is
already implicit in the check for king moves and castling
is so rare that doing the check is just a slow down.

Thanks to Marek Kwiatkowski.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire move_is_capture_or_promotion()
Marco Costalba [Tue, 17 May 2011 22:39:14 +0000 (23:39 +0100)]
Retire move_is_capture_or_promotion()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoFix move_is_capture() definition
Marco Costalba [Tue, 17 May 2011 22:31:40 +0000 (23:31 +0100)]
Fix move_is_capture() definition

The structure of move is changed so should also the two
functions. It happens that it works by accident !

Bug spotted by Marek Kwiatkowski

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire test for king moves in see()
Marco Costalba [Tue, 17 May 2011 10:24:06 +0000 (12:24 +0200)]
Retire test for king moves in see()

We already test this condition in see_sign() and
so it is almost always a redundant verification.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
12 years agoRetire Position::see(Square from, Square to) overload
Marco Costalba [Tue, 17 May 2011 10:09:45 +0000 (12:09 +0200)]
Retire Position::see(Square from, Square to) overload

Alomst unuseful.

No functional change.

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