#🔒 (Chess) Why aren't my magic bitboards working?

4 messages · Page 1 of 1 (latest)

dark cradle
#

Code is found here.

I'm having trouble constructing a magic bitboard lookup table as per this example and the magicmoves.c file that I translated to Python.

Quick download to this and the .h file are here (link taken from the website above for QOL)

As per stats I take after the lookup table is filled in, I get these results: ```yml
Bishop table:

Filled spaces: 5248
Empty spaces: 27520
Total spaces: 32768

Rook table:

Filled spaces: 32768
Empty spaces: 229376
Total spaces: 262144


I would expect to have both tables filled up, yet only 16% of the bishop table is filled and only 12.5% of the rook table is filled. Why would this be?

Is it how I constructed my arrays by first filling them with zeroes and then replacing them with other values? I tried to implement how I'd think C would manage creating and editing arrays but I have never dug that deep into C and don't plan on it any time soon. Source code took quite a while to translate too.

> Previous post: https://discord.com/channels/@me/1244078667999477922/1274205519770292234
violet wharfBOT
#

@dark cradle

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

violet wharfBOT
#

@dark cradle

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.