What is the best data-structure to represent a checkers board when speed is the primary concern?

后端 未结 6 1731
陌清茗
陌清茗 2020-12-31 18:23

I am currently implementing something quite similar to checkers. So, I have this table game and there are both white and black pieces. Where there are neither white or black

6条回答
  •  说谎
    说谎 (楼主)
    2020-12-31 18:54

    I would also use a bitmap for this. The functions to check for 1, 2, and 3 will be a little unintuitive to write, but should be very fast.

    You'll, of course, need to be careful of the edge cases and a fast solution will probably involve some integer and modular arithmetic on the indexes.

提交回复
热议问题