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

257 commits

Author SHA1 Message Date
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
ee6e8851be Templetize generate_castle_moves()
Cleanup the code and remove lines.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2009-02-06 07:14:38 +01:00
Marco Costalba
03211296f1 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>
2009-02-06 07:14:16 +01:00
Marco Costalba
8a0dd93c56 Generate moves for powerful pieces first
This seems to reduce searched nodes by a
surprising 2.5%

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
2008-11-24 20:43:29 +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
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
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
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
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
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
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
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
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
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
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