国际象棋滑动棋子位板

发布于 2024-12-21 16:34:41 字数 393 浏览 5 评论 0原文

我很容易理解非滑动件,但我在滑动件方面遇到了一些麻烦。

我目前有 64 个位板(每个方块 1 个,未保存在数组中,还有 8 个用于屏蔽行的位板,8 个用于清除行的位板,8 个用于屏蔽列的位板,8 个用于清除列的位板,当然还有,每种类型的棋子的位板。

在为主教和车生成合法的移动时,我听说您应该获得列/行上的第一个占据的方块。

我的问题是:

  • 您如何知道在哪里。 rook 是 和它以及适当的掩码,
  • 您如何准确地获得对角线中的第一个被占用的方块。
  • 如果您知道任何其他常见的位板,这将有助于我在后面的任务,那么 让我知道它们。

目前我没有分支,并且希望减少我使用的分支数量,但我觉得这里需要一些分支,并且很好奇解决这个问题的最有效方法。

I understood non-sliding pieces quite easily but I've been having some trouble with the sliding pieces.

I currently have 64 bitboards (1 for each square, not saved in a array as well as 8 bitboards for masked rows, 8 bitboards for cleared rows, 8 bitboards for masked columns, and 8 bitboards for cleared columns, as well as, of course, a bitboard for each type of piece.

In generating legal moves for the bishop and rook I hear you are suppose to get the first occupied square on the column/row.

My questions are:

  • how do you know where the rook is to and it together with the appropriate mask.
  • how exactly do you get the first occupied square in the diagonal as well for the Bishop.
  • if you know of any other common bitboards which will help me in my tasks at a latter point, please let me know of them.

Currently I have it going with no branches and would like to keep the amount of branches I use down but I feel some will be needed here and am curious about the most efficient way to go about solving this problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

來不及說愛妳 2024-12-28 16:34:41

关于棋盘表示Bitboard 对该主题提供了很好的解释。

此外,它们还包含许多有趣的链接,指向有价值的参考资料。

我特别建议您研究 Crafty 的源代码。它的作者是一位知名权威:Robert Hyatt 博士。

Wikipedia entries on Board representation and Bitboard provide good explanation on the topic.

Moreover, they contain a bunch of interesting links pointing to valuable references.

I particularly advise you to study Crafty's source code. It was written by a well known authority: Dr.Robert Hyatt.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文