Skip to content

move_handling: improve castle rights | mask_tables: move tables and clean up mask table usage - #192

Merged
hansbinderup merged 3 commits into
mainfrom
hans/improve-castle-rights
Jul 26, 2025
Merged

move_handling: improve castle rights | mask_tables: move tables and clean up mask table usage#192
hansbinderup merged 3 commits into
mainfrom
hans/improve-castle-rights

Conversation

@hansbinderup

@hansbinderup hansbinderup commented Jul 23, 2025

Copy link
Copy Markdown
Owner

See each commit for details :)

Mostly a clean up but also a slight performance gain in terms of the castle lookup and faster pawn attack lookup (only for terms not movegen).

Elo   | 3.23 +- 4.65 (95%)
SPRT  | 8.0+0.08s Threads=1 Hash=32MB
LLR   | 2.95 (-2.94, 2.94) [-5.00, 0.00]
Games | N: 9788 W: 2399 L: 2308 D: 5081
Penta | [248, 1171, 1990, 1212, 273]
https://openbench.bunny.beer/test/569/

@hansbinderup hansbinderup added this to the release-1.10 milestone Jul 23, 2025
@hansbinderup
hansbinderup force-pushed the hans/improve-castle-rights branch 2 times, most recently from 2833d26 to 2b3971d Compare July 23, 2025 22:11

@clarashepherd clarashepherd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! My only suggestion is that perhaps the second and third commits could be combined, because they both perform a cleanup and reduce redundancy :)

The colour-swap trick is neat ⚡

@hansbinderup

Copy link
Copy Markdown
Owner Author

Looks good! My only suggestion is that perhaps the second and third commits could be combined, because they both perform a cleanup and reduce redundancy :)

You're right, I'll squash them 👍

The colour-swap trick is neat ⚡

Glad you like it 🚀

No need to do runtime look up when we can do it at compile time. Minor
improvement, but a nice little clean up.

Bench 1354847

Signed-off-by: Hans Binderup <hbinderup94@gmail.com>
This will make it possible to add more generic masks to the file as
well.
Also it was stored in evaluation context which is not correct.
Now it's stored as a core feature which should be able to be used by any
part of the engine.

This commit also cleans up the mask tables a bit.
Now there's less redundant code and we store all the mask tables in one
location.

Bench 1354847

Signed-off-by: Hans Binderup <hbinderup94@gmail.com>
Before we had an odd mask table; a kinda reversed pawn attack mask where
we could look up the pawns based on where it would attack from for a
given position.

This is quite redundant as we already have a way to compute this.. ie.
just invert the attack (use white instead of black eg).

Bench 1354847

Signed-off-by: Hans Binderup <hbinderup94@gmail.com>
@hansbinderup
hansbinderup force-pushed the hans/improve-castle-rights branch from 2b3971d to fd562b3 Compare July 26, 2025 20:09
@hansbinderup
hansbinderup merged commit 8d372e2 into main Jul 26, 2025
6 checks passed
@hansbinderup
hansbinderup deleted the hans/improve-castle-rights branch July 26, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants