Marco Costalba
1146fc8d09
Space inflate move.cpp
...
Also a little cleanup.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-11-01 12:46:53 +01:00
Marco Costalba
6e5cf2f3c5
Revert "Relax time constraints"
...
Does not seem to give an improvment, acutually it seems
a totally neutral change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-11-01 12:46:53 +01:00
Marco Costalba
e5ebd4f5d1
Partially space inflate search.cpp
...
Space inflate main remaining functions in search.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-11-01 12:46:53 +01:00
Marco Costalba
cf2bafb661
Relax time constraints
...
Allow a seacrh to take a bit more time if needed.
This reduces the chanches of wast all the search time
for the last iteration and also allow to start the last
iteration when we have less time remaining.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-11-01 12:46:53 +01:00
Marco Costalba
79513e3a43
Material: micro optimize map reading
...
Do only one map walk per read instead of two.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-11-01 12:46:52 +01:00
Marco Costalba
bd3ec6af15
Material: protect global map access with locks
...
STL library is not guaranteed to be thread safe, even for
read-access.
So because these global maps are accessed by all the threads
we need to protect them.
This fixes a random crash experienced during testing.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-11-01 12:46:52 +01:00
Marco Costalba
b2b86cfd27
MovePicker::score_captures() order with SEE when pv
...
Order PV nodes by SEE instead of MVV/LVA.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-11-01 12:46:52 +01:00
Marco Costalba
7d717df4e4
Revert "Last minute surprise" for now
...
It defenitly needs more testing. Just postponed.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-11-01 12:46:52 +01:00
Marco Costalba
5e906ea10e
Finish material.cpp cleanup
...
Hopefully no regression this time!
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-11-01 12:46:52 +01:00
Marco Costalba
73cce873de
Start to simplify material.cpp
...
It is posisble to simplify a lot here!
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-11-01 12:46:51 +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
5e2fc2aa16
Fix a bug in generate_evasions()
...
Introduced in the patch "movegen: prefer (*mlist++) to mlist[n++]"
This was nasty because due to a mismerge the repo in one PC had the bug,
but the testing one did not, so I had non reproducible results according
to which machine I used for testing.
This hopefully closes a more then one week regression that made me go crazy!
It was found by accident comparing, for other reasons, the sources of the
two PC's.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-11-01 12:46:51 +01:00
Marco Costalba
74fd57220e
Refine "few moves" in "last minute surprise"
...
It seems that "few moves" works because we extend the good
captures at the last ply of PV, so code it directly.
This version seems defenitly stronger then previous one.
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
0936a96a0e
Space inflate extension() code
...
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-26 21:30:21 +01:00
Marco Costalba
13d1776a98
TEST: extend when few moves available
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-26 21:30:21 +01:00
Marco Costalba
a56e1c662c
Revert see shortcut when only one attacker
...
It does not seem to work after a little testing.
Perhaps it works on the long terms, but it is also
ugly because not correct, so revert for now.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-26 21:30:21 +01:00
Marco Costalba
fcc49561a1
Prefer out of loop variables in MovePicker::score_captures()
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-26 21:30:21 +01:00
Marco Costalba
714069e248
Effectively use MVV/LVA in MovePicker::score_captures()
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-26 21:30:20 +01:00
Marco Costalba
88885399f4
Reintroduce piece/square tables to score non-captures
...
Was removed after original movepick restore. But proved
to be useful.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-26 21:30:20 +01:00
Marco Costalba
a5c1b3e8f6
Position: fix a couple of Intel compiler warnings
...
Plus usual trailing whitespace.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-26 13:23:27 +01:00
Marco Costalba
8a85007023
Test with SEE shortcut
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-26 10:11:13 +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
4f14bd5032
Try to cleanup movepick
...
Hopefully without regressions.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-26 10:11:13 +01:00
Marco Costalba
f8bc38a006
Restore original movepick modulo space inflation
...
We have a regression somewhere here so restart from zero
and proceed one change at a time.
With this modification we have the same strenght of
"Introduce Stockfish" patch that is our strongest to date.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-26 10:11:13 +01:00
Marco Costalba
5dd9159106
Space inflate position: complete!
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-26 10:10:56 +01:00
Marco Costalba
ad956ef00a
Space inflate position until do_promotion_move()
...
We will end some day ;-)
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-24 21:10:05 +02:00
Marco Costalba
d155cd88d1
Start to space inflate position.cpp
...
It's a big file!
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-24 21:10:05 +02:00
Marco Costalba
2aebf8eb55
Fix a performance bug in generate_move_if_legal
...
Use the pinned argument in pos.move_is_legal()
No functional change, simply use pos.move_is_legal() as
was meant to be.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-24 21:10:05 +02: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
2f8961beef
movegen: add SERIALIZE_MOVES and hides a bunch of loops
...
Only syntactic sugar, perhaps we should leave as is, anyhow...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-24 21:10:04 +02:00
Marco Costalba
af5743837d
Another generate_piece_moves() micro optimization
...
This time on the for loop.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-24 21:10:04 +02:00
Marco Costalba
5e768e4b0a
Fix another template conversion bug in movegen
...
Hopefully the last one.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-24 21:09:51 +02:00
Marco Costalba
2d867109d9
movegen: prefer (*mlist++) to mlist[n++]
...
Teoretically faster, practically it helps to
removes some more lines.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-23 07:17:04 +02:00
Marco Costalba
b145e99559
Fix a bug in generate_pawn_captures()
...
Introduced in "movegen: Introduce generate_pawn_captures()"
when unifiying black and white functions.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-23 07:17:04 +02:00
Marco Costalba
8f2c1c59eb
Fully templetize pawn move generators
...
A little bit more syntax heavuer but surely faster.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-23 07:17:04 +02:00
Marco Costalba
c40249e9d2
Micro optimize generate_piece_moves()
...
It is a time critical path. The biggest in move generation.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-21 00:10:27 +02:00
Marco Costalba
ce93a202b5
Another Intel warning sqeezed
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:57:13 +02:00
Marco Costalba
279ed7ed48
Quiet a warning on Intel compiler
...
Plus usual trailing whitespace noise.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:55:43 +02:00
Marco Costalba
af6571856e
Shrink arguments in move generation functions
...
Perhaps no speedup, but it is more readable.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:47:21 +02:00
Marco Costalba
0c8659721f
Fix a bug in king discoveries checks
...
Introduced in "Add a generate_piece_checks() specialization for the king"
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:47:20 +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
aa94f2f4c2
Last little touches to movegen
...
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:47:19 +02:00
Marco Costalba
d7161c1ce6
Rename PawnOffsets in PawnParams
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:47:19 +02:00
Marco Costalba
e2af0e775b
Pawn move generator: dispatch at compile time
...
Instead of function pointers use templates to
dispatch shift operations.
It is more clear and possibly also faster because
branches are removed at compile time.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:47:19 +02:00
Marco Costalba
ad1bb084dd
Start to templetize pawn move generators
...
Still very soft, we will see if compiler is
enough or we need more aggressive templetization.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:47:18 +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
7eb290a509
Add a generate_piece_checks() specialization for the king
...
Also reshuffle the code a bit.
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
691de79eaa
Fix a missing comma in BenchmarkPositions[]
...
An old bug introduced in 3e0dc9ee84 almost
one month ago.
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
6b8a07eccc
Fix an assert due to a missing parentesis
...
Bitwise operators precedence issue here, was
causing an assert.
This is a fallout from recent patches.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:47:15 +02:00
Marco Costalba
8e85aa3a65
Final semplification of generate_evasions()
...
Now it's readable!
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:47:15 +02:00
Marco Costalba
4f18528a1c
Introduce generate_piece_blocking_evasions()
...
Start to simplify generate_evasions
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:47:15 +02:00
Marco Costalba
4a4d62da13
Space inflate generate_evasions()
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-20 21:47:15 +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
f664ca41ed
Last little touches to movegen
...
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-19 20:43:21 +01:00
Marco Costalba
b397426785
Rename PawnOffsets in PawnParams
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-19 20:43:09 +01:00
Marco Costalba
68c78400c8
Pawn move generator: dispatch at compile time
...
Instead of function pointers use templates to
dispatch shift operations.
It is more clear and possibly also faster because
branches are removed at compile time.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-19 20:42:12 +01:00
Marco Costalba
1bd1f5a293
Start to templetize pawn move generators
...
Still very soft, we will see if compiler is
enough or we need more aggressive templetization.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-19 16:20:21 +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
305b711ca8
Add a generate_piece_checks() specialization for the king
...
Also reshuffle the code a bit.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-19 13:22:03 +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
832a8a2719
Fix a missing comma in BenchmarkPositions[]
...
An old bug introduced in 3e0dc9ee84 almost
one month ago.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-19 11:55:53 +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
00bcc64787
Fix an assert due to a missing parentesis
...
Bitwise operators precedence issue here, was
causing an assert.
This is a fallout from recent patches.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-19 10:17:17 +01:00
Marco Costalba
f2ead1004a
Final semplification of generate_evasions()
...
Now it's readable!
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-19 09:33:33 +01:00
Marco Costalba
84ce43498a
Introduce generate_piece_blocking_evasions()
...
Start to simplify generate_evasions
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-19 08:49:26 +01:00
Marco Costalba
987ff3b4b6
Space inflate generate_evasions()
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-19 08:27:24 +01:00
Marco Costalba
72289fcfab
movegen: Introduce generate_pawn_noncaptures()
...
This is the last of pawn moves generators converted
to new unified form.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:35 +02:00
Marco Costalba
73d0d2c0b2
movegen: Introduce generate_pawn_captures()
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:35 +02:00
Marco Costalba
c1257d45b2
movegen: Fix just introduced move counter bug
...
This is what happens when you don't tests your patches !!
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:35 +02:00
Marco Costalba
34a515f20b
movegen: Introduce generate_pawn_checks()
...
This greatly simplify redundant code.
Perhaps slihtly slower. Test needed.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:35 +02:00
Marco Costalba
5abe8a0816
generate_checks: fix a bug in black double pawn push
...
It was written pos.black_pawn_attacks(ksq) instead of
pos.white_pawn_attacks(ksq)
Updated to the undrlying pos.pawn_attacks(WHITE, ksq)
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:34 +02:00
Marco Costalba
35fd5ce5bc
Space inflate generate_castle_moves()
...
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:34 +02:00
Marco Costalba
146bb2dfa7
Unify pieces check generation with generate_piece_checks()
...
Could be slower: test needed!
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:34 +02:00
Marco Costalba
ea16985ea5
Do not special case generate_king_moves()
...
Teoretically a little slowdown. If after testing we
verify the slowdown has impact on ELO we revert the
change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:34 +02: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
94f1b31484
movegen: revert see ordering in score_captures()
...
It works better with MVV ordering.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:33 +02:00
Marco Costalba
c852a94009
Movegen: further simplify generate_move_if_legal
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:33 +02:00
Marco Costalba
8be2c483a1
Unify black and white code in generate_move_if_legal()
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:33 +02:00
Marco Costalba
158911425b
Space inflate movegen.cpp
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:33 +02:00
Marco Costalba
cf8ee79b76
Movepick: add and use find_best_index() helper
...
This removes a bunch of redundant code.
No functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:33 +02:00
Marco Costalba
06d6468ce9
Test with see
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:33 +02:00
Marco Costalba
173ecc0acf
Use MVV to score captures when see >=0
...
This fix a couple of dubious bugs in MVV/LVA
ordering.
Tests seems to confirm now is slightly better.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:32 +02:00
Marco Costalba
2943e1ca31
MovePicker: use const reference instead of pointers
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:32 +02:00
Marco Costalba
486ec580f9
Space inflate movepick.cpp
...
Also added some FIXME to dubious points.
Still no functional change.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:32 +02:00
Marco Costalba
a930aafce0
Better comment previous patch
...
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:32 +02:00
Marco Costalba
b3744eb4d0
Always add psqt scoring
...
When there is also history, history is always
preferred.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:32 +02:00
Marco Costalba
a03ab94f44
Shortcut sorting when no move is in history
...
An alternative algorithm to psqt scoring.
Still unclear what is the best, more tests needed.
Signed-off-by: Marco Costalba <mcostalba@gmail.com >
2008-10-18 21:35:20 +02:00