]>
git.sesse.net Git - stockfish/log
Marco Costalba [Fri, 20 Mar 2009 11:33:30 +0000 (12:33 +0100)]
LMR dynamic reduction
Reduce of two plies near the leafs and when we still
have enough depth to go so to limit horizon effects.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Mar 2009 13:49:18 +0000 (14:49 +0100)]
Always print a best move when requested
Little fix merged from iPhone Glaurung.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Mar 2009 13:32:00 +0000 (14:32 +0100)]
Better castle move detector in move_to_san()
Merged from iPhone Glaurung.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Mar 2009 13:18:25 +0000 (14:18 +0100)]
Fix a smal bug in Position::from_fen
We could fail to parse an en-passant position
in same cases.
Merged from iPhone Glaurung.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Mar 2009 12:55:08 +0000 (13:55 +0100)]
Merge new pawn storm evaluation
More accuracy in pawn storm evaluation
directly from iPhone Glaurung.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Mar 2009 12:11:24 +0000 (13:11 +0100)]
Fix a small bug in king safety
Merged from iPhone Glaurung.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Mar 2009 12:06:29 +0000 (13:06 +0100)]
Merge KBPP vs KB endgame from iPhone Glaurung
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 21 Mar 2009 13:51:31 +0000 (14:51 +0100)]
Fix: In qsearch do not use TT value when in a PV node
We already do like this in search_pv(), so extend
also in qsearch().
Bug spotted by Joona Kiiski.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 18 Mar 2009 14:36:03 +0000 (15:36 +0100)]
Big headers cleanup
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 16 Mar 2009 12:59:41 +0000 (13:59 +0100)]
Safe guard some wild and ugly casts
These casts are needed but plain ugly, at least be
sure they don't hide any subtle conversion bug.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 16 Mar 2009 07:02:33 +0000 (08:02 +0100)]
Partially revert pawns storm bug fix
Try to save space and use the minimum size
possible.
In particular restore int16_t for values and int8_t
for halfOpenFiles.
Use int16_t for storm values insted of int and also
instead of original buggy and too small int8_t.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 15 Mar 2009 17:07:28 +0000 (18:07 +0100)]
Silence a good bunch of Intel warnings
Note that some pawns and material info has been switched
to int from int8_t.
This is a waste of space but it is not clear if we have a
faster or slower code (or nothing changed), some test should be
needed.
Few warnings still are alive.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 15 Mar 2009 17:06:40 +0000 (18:06 +0100)]
Fix an overflow bug in pawns stormValue
These fields are defined as int8_t but values bigger
then 127 are stored there so that we silently overflow.
Fix bringing up all the fields to a sane int type. This
will increase memory usage, but apart from being safe, it is
not clear if code is slower or faster. Test is needed.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 15 Mar 2009 16:02:09 +0000 (17:02 +0100)]
Fix a silly warning on Intel compiler
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 15 Mar 2009 15:44:12 +0000 (16:44 +0100)]
Revert NULL move beta corrections
After testing result is bad -25 ELO
Marco Costalba [Fri, 13 Mar 2009 14:39:22 +0000 (15:39 +0100)]
Retire Null Driven IID
It does not seem to clearly improve things and
in any case is disabled by default, so retire for now.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 13 Mar 2009 14:26:02 +0000 (15:26 +0100)]
Merge Joona Kiiski NULL search beta correction
Prune more moves after a null search because of
a lower beta limit then in main search.
In test positions reduces the searched nodes of 30% !!!!
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 13 Mar 2009 10:20:24 +0000 (11:20 +0100)]
Merge Joona Kiiski evaluation tweaks
Merge tewaks to many evaluation parameters
by Joona Kiiski.
After test they seem good!
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 7 Mar 2009 19:38:05 +0000 (20:38 +0100)]
Micro optimize move_is_check()
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 7 Mar 2009 19:08:45 +0000 (20:08 +0100)]
Micro optimize pl_move_is_legal()
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 6 Mar 2009 19:39:43 +0000 (20:39 +0100)]
Micro optimize previous patch
Also remove some Intel warnings, not all :-(
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 6 Mar 2009 15:29:46 +0000 (16:29 +0100)]
Introduce evaluate_pieces<>() to remove redundancy
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 4 Mar 2009 22:11:23 +0000 (23:11 +0100)]
Fix compile error with inlines under gcc and Intel
It seems that these compilers do not like inline functions
that call a template when template definition is not in scope.
So move functions from header to in *.cpp file
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 4 Mar 2009 15:34:04 +0000 (16:34 +0100)]
Fix some comments in position.cpp
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 4 Mar 2009 13:50:39 +0000 (14:50 +0100)]
Avoid to call useless sliders attacks in update_checkers()
Quickly filter out some calls to sliders attacks
when we already know that will fail for sure.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Wed, 4 Mar 2009 11:04:28 +0000 (12:04 +0100)]
Super fast hidden_checkers()
Rewritten hidden_checkers() to avoid calling
sliders attacks functions but just a much
faster squares_between()
Also a good code semplification.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Tue, 3 Mar 2009 10:17:43 +0000 (11:17 +0100)]
Cleanup SearchStack initialization
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 2 Mar 2009 16:32:30 +0000 (17:32 +0100)]
Micro optimize copy of new state in do_move()
Instead of copying all, copy only the fields that
are updated incrementally, not the ones that are
recalcuated form scratch anyway.
This reduces copy overhead of 30%.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 2 Mar 2009 15:20:00 +0000 (16:20 +0100)]
Revert hidden checkers rework
It is slower the previous uglier but faster code.
So completely restore old one for now :-(
Just leave in the rework of status backup/restore in do_move().
We will cherry pick bits of previous work once we are sure
we have fixed the performance regression.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 28 Feb 2009 15:49:50 +0000 (16:49 +0100)]
Use checker info to remove a bunch of hidden checks updates
Another powerful condition let us remove a big chunk of
useless updates.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 28 Feb 2009 12:43:49 +0000 (13:43 +0100)]
Stricter condition to check for dc candidates
Another optimization that let us remove another half
of find_hidden_checks(them, DcCandidates) calls.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 28 Feb 2009 09:20:57 +0000 (10:20 +0100)]
Split calculation of pinners from dc candidates
This let us to calculate only pinners when we now that
dc candidates are not possible.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 28 Feb 2009 08:42:52 +0000 (09:42 +0100)]
Slightly better condition in update_hidden_checks()
Use a more strict condition to check if we have captured
an opponent pinner or hidden checker.
With this patch the occurrence of checkerCaptured == true are
reduced of 50%.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 28 Feb 2009 08:18:29 +0000 (09:18 +0100)]
Compute pinned and friends incrementally
In do_move() use previous pinned bitboards values to compute
the new one after the move. In particulary we end up with the
same bitboards in most cases. So detect these cases and just
keep the old values.
This should speedup a lot this slow computation in a very hot
path so that we can use this important info everywhere in the
code at very cheap cost.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 23 Feb 2009 17:46:33 +0000 (18:46 +0100)]
Fix a subtle bug due to the StateInfo pointer became stale
There was one occurence when the StateInfo variable went
out of scope before the corresponding Position object.
This yelds to a crash. Bug was not hit before because occurs
only when using an UCI interface and not the usual benchmark.
The fix consists in copying internally the content of the
about to stale StateInfo.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 23 Feb 2009 14:19:51 +0000 (15:19 +0100)]
Teach SEE about pinned pieces
Remove pinned pieces from attacks when calculating
SEE value.
Algorithm is not perfect, there should be no false
positives, but can happen that we miss to remove a
pinned piece. Currently we don't cach 100% of cases,
but is a tradeoff between speed and accuracy. In any
case we stay on the safe side, so we remove an attacker
when we are sure it is pinned.
About only 0,5% of cases are affected by this patch, not
a lot given the hard work: this is a difficult patch!
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 23 Feb 2009 11:48:57 +0000 (12:48 +0100)]
Small Position::clear() cleanup
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 23 Feb 2009 11:06:06 +0000 (12:06 +0100)]
Do not copy the whole old state in do_move()
Instead of copy the old state in the new one, copy only
fields that will be updated incrementally, not the ones
that will be recalculcated anyway.
This let us copy 13 bytes instead of 28 for each do_move()
call.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Mon, 23 Feb 2009 10:37:31 +0000 (11:37 +0100)]
Update pinned bitboards and friends in do_move()
Probably is slightly slow, but code is surely better
in this way. We will optimize later for speed.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Feb 2009 23:21:11 +0000 (00:21 +0100)]
Fix some asserts unhidden by a debug compile
Fallback form previous patches.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Feb 2009 20:06:52 +0000 (21:06 +0100)]
Avoid resetting pinners[c]
Small optimization. No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Feb 2009 19:16:21 +0000 (20:16 +0100)]
Introduce StateInfo instead of UndoInfo
We don't backup anymore but use the renamed StateInfo
argument passed in do_move() to store the new position
state when doing a move.
Backup is now just revert to previous StateInfo that we know
because we store a pointer to it.
Note that now backing store is up to the caller, Position is
stateless in that regard, state is accessed through a pointer.
This patch will let us remove all the backup/restore copying,
just a pointer switch is now necessary.
Note that do_null_move() still uses StateInfo as backup.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Feb 2009 17:31:24 +0000 (18:31 +0100)]
Wrap state variables in a named struct
This will allow us to more easily move the state
out of Position class.
No functioanl change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Feb 2009 17:03:23 +0000 (18:03 +0100)]
Convert also undo_null_move() to avoid passing UndoInfo object
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sun, 22 Feb 2009 16:49:52 +0000 (17:49 +0100)]
Passing UndoInfo is not needed anymore when undoing the move
We store it now in the same UndoInfo struct as 'previous'
field, so when doing a move we also know where to get
the previous info when undoing the back the move.
This is needed for future patches and is a nice cleanup anyway.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Sat, 21 Feb 2009 18:59:29 +0000 (19:59 +0100)]
Remove two useless calls to pinned_pieces()
Are obsoleted by new pinned caching code.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 20 Feb 2009 11:21:52 +0000 (12:21 +0100)]
Position: Unify and templetize mg_pst() and eg_pst()
Also templetize compute_value() can be simpler now that
the above is templetized too.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Marco Costalba [Fri, 20 Feb 2009 11:05:07 +0000 (12:05 +0100)]
Unify compute_mg_value() and compute_eg_value()
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>