1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 00:33:09 +00:00
Commit graph

144 commits

Author SHA1 Message Date
Marco Costalba
1dc27f3232 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>
2009-02-20 22:50:08 +01:00
Marco Costalba
95cfc0e306 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>
2009-02-20 22:49:54 +01:00
Marco Costalba
683e6dc656 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>
2009-02-19 17:29:36 +01:00
Marco Costalba
c6630abe0d Do not pass pinned argument in Position::move_is_check()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-19 17:01:08 +01:00
Marco Costalba
734941672e Do not pass pinned argument in Position::pl_move_is_legal()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-19 16:48:57 +01:00
Marco Costalba
5f142ec209 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>
2009-02-19 16:28:35 +01:00
Marco Costalba
7013efce4e Change piece_attacks_square() API
An extra argument let us simplify some code.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-17 12:00:05 +01:00
Marco Costalba
2c955f25de 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>
2009-02-17 10:54:47 +01:00
Marco Costalba
a188a047ab Use update_checkers<>() also for PAWN
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-13 20:54:37 +01:00
Marco Costalba
1d2247aea3 Introduce update_checkers() to simplify do_move()
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-13 20:54:17 +01:00
Marco Costalba
8365f8ac1e Remove square_is_attacked()
Use attacks_to() instead. No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-13 20:53:58 +01:00
Marco Costalba
76381cbd69 Small code style tidy up
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-07 13:26:42 +01:00
Marco Costalba
aaad48464b Add a see() function that take only destination square
In this case firstlocates the least valuable attacker, if any,
then proceed as usual.

This will be used by next patch.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-12-10 00:13:59 +01:00
Marco Costalba
20d7197a9b MovePicker: use EvalInfo to skip generating captures
When we know already no captures are possible in a given
position.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-16 12:37:46 +01:00
Marco Costalba
3c05bd70eb Print the move in addition to position
Teach Position::print() to optionally print a
given move in san notation in addition to
the ASCII representation of the board.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-16 12:37:46 +01:00
Marco Costalba
899b9455d6 Material: lockless per-thread maps
Adds a good bunch of code but should be faster
and scalable because is lockless.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-01 12:46:54 +01:00
Marco Costalba
038235ba35 Factor out Position::do_capture_move()
Start to slim line count i position.cpp

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-01 12:46:51 +01:00
Marco Costalba
74f1efee26 Manual merge 2008-10-26 21:44:58 +01:00
Marco Costalba
4397e6c03e Better naming of pseudo-legality and legality testing
No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-26 10:11:13 +01:00
Marco Costalba
1ac2f50145 Unify pinned and discovery checks code
Templates are our friends here. No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-24 21:10:04 +02:00
Marco Costalba
af59cb1d63 Refactor Position::pinned_pieces() to use templates
Also better document this interesting function.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-24 21:10:04 +02:00
Marco Costalba
5dc2312121 Update copyright info
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:20 +02:00
Marco Costalba
760f77872f Remove Positions::xxx_count() functions
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:18 +02:00
Marco Costalba
257689dec7 Remove white/black_pawn_attacks_square()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:18 +02:00
Marco Costalba
ff211469ba Templetize Position::xxx_attacks_square()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:17 +02:00
Marco Costalba
d4f14a8e83 Remove Position::xxx_list() functions
No useful, only obfuscating.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:17 +02:00
Marco Costalba
d316b02771 Remove white/black_pawn_attacks()
Unuseful syntactic sugar, obfuscates the
real code.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:17 +02:00
Marco Costalba
d9e54ceaa1 Prefer template to name decoration
This also allows faster code although bigger.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:16 +02:00
Marco Costalba
3f38cca072 Position::is_ok()give more info on failed test
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-20 21:47:16 +02:00
Marco Costalba
d3600c39a7 Update copyright info
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-19 20:43:33 +01:00
Marco Costalba
d0e51bc0f0 Remove Positions::xxx_count() functions
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-19 14:39:29 +01:00
Marco Costalba
0d19437703 Remove white/black_pawn_attacks_square()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-19 14:06:06 +01:00
Marco Costalba
8b5519a009 Templetize Position::xxx_attacks_square()
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-19 13:56:57 +01:00
Marco Costalba
1eae58523f Remove Position::xxx_list() functions
No useful, only obfuscating.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-19 13:44:25 +01:00
Marco Costalba
2bea93975e Remove white/black_pawn_attacks()
Unuseful syntactic sugar, obfuscates the
real code.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-19 12:53:51 +01:00
Marco Costalba
f036239521 Prefer template to name decoration
This also allows faster code although bigger.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-19 12:43:09 +01:00
Marco Costalba
11910d44e0 Position::is_ok()give more info on failed test
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-19 10:41:24 +01:00
Marco Costalba
3b857d1625 Use a const pointer-to-member array for attacks
Allow the compiler to optimize member
function access.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:34 +02:00
Marco Costalba
aa7121297d Use pointer-to-members to remove a bunch of duplicated code
Remove all generate_XXX_moves() functions, use an array
of pointer to members instead.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-18 21:35:34 +02:00
Marco Costalba
644db060ae Add psqt ordering when there is no history
This seems to increase strenght (about 15 ELO),
still to test some variations on this theme that
could increase ELO even more.

Idea from Rebel (http://members.home.nl/matador/chess840.htm)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-10-15 07:18:05 +01:00
Marco Costalba
88bb3c9422 Start to cleanup position.cpp
Still a lot to do. No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-28 10:58:56 +02:00
Marco Costalba
f56af8e84d Rename pawn_rank() in relative_rank()
It is more clear, at last for me.

Also cleanup evaluate_rook() and evaluate_queen()

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-24 21:02:15 +02:00
Marco Costalba
4c5eaeb363 Disable a stupid and noisy MSVC warning
Remove the crap from compiler messages.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-09-18 12:27:09 +02:00
Marco Costalba
bb751d6c89 Initial import of Glaurung 2.1 2008-09-01 07:59:13 +02:00