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

1424 commits

Author SHA1 Message Date
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