What is the most practical board representation for a magic motion generation system?

I am rewriting a chess engine I wrote to run on magic bits. I have magic functions written, and they take the square of the part and the loading board as parameters. What I have debating with myself is that one of these schemes for presenting advice is faster / more practical:

scheme 1: for each type of item there is a bitbore, 1 for white knights, 1 for black rooks. ,, and in order to generate moves and push them onto the move stack, I have to serialize them to find the square of the piece and then trigger the magic function. Then I have to serialize these bit moves and push them. The advantage is that attack and boot bits are closer to hand.

diagram 2: a simple centered figure [2] [16] or [32] contains the square indices of the parts. A simple loop and function calls are all it takes to move the bits. Then I serialize those bits and pop them onto the move stack. I also have to maintain a bootable board. My guess is that getting the bitbit attack shouldn't be any different: I need to re-create all the moving bits and instead of serializing them, I manipulate them bit by bit in magic machines.

I'm leaning towards Scheme 2, but for some reason I think there is some implementation similar to Standard Scheme 1. For some reason I can't seem to find the disadvantages of creating a "bit" engine without actually using bits. I wouldn't even use bits for the king and knight data, just a quick search in the array.

I think my question is, is there a better way to make this whiteboard view, because I remember reading that storing bits for every type of item is standard (maybe this is only needed for rotating bits?). I'm relatively new to bit systems, but I've read a lot and I've implemented a magic method. I like the centric array approach of course - it makes a lot of arbitrary things like printing the board to the screen easier, but if there is a better / equal / more standard way, can someone point it out? Thanks in advance - I know this is a pretty specific question and difficult to answer if you are not very familiar with chess programming.

Last minute question: How is the search speed of a 2D array measured prior to using a 1D array and adding 16 * team_side to the normal index to search for a part?

edit . I thought I should add that I rate speed in almost all other games of chess. Why else would I go with magic bits and not just arrays of slide data?

+3


source to share


1 answer


There is no standard answer to this question, sorry.

The number and types of data structures required depends on what you want to do in your program. For example, having more than one representation of parts on a board makes some operations faster. On the other hand, it takes extra time to update the data during each step.



To get the fastest speed, your job is to figure out what works best for your program. Does the extra array of chunks keep the program pure speed? It depends!

Sometimes it is pure profit to maintain the data structure, sometimes you can delay computation and cache the result, and sometimes you just compute it when needed (and hope you don't need it very often).

+1


source







All Articles