bitboard

Understanding “o^(o-2r)” formula for generating sliding piece moves using unsigned bitboards?

狂风中的少年 提交于 2021-01-28 20:14:32
问题 What I Am Trying To Do I am trying to perform some bitwise operations to create a chess engine. To make this engine, I need to be able to generate moves for pieces, like rooks. There is a handy formula for creating a bitboard of squares available for the rook to move to: bitboardOfOccupiedSquares ^ (bitboardOfOccupiedSquares - 2 * bitboardOfPieceToMove) . Consider the following chess board position: I am trying to generate all of the squares that the rook on h1 can move to. So this should be

Algorithm Trax Winning Condition

笑着哭i 提交于 2020-01-03 05:20:26
问题 I tried to implement the game Trax in C++. For those who do not know: http://www.traxgame.com/about_rules.php I have built the board so far and created the rules where I can put my next Tile and which one I am allowed to set. But now, I am struggling with the winning conditions. As you can see, I need a line of at least 8 tiles.. My first solution attempt had included way to many if-conditions. That is simply not possible. So i need to implement a proper algorithm.. My secong attempt using a

Chess bitboard implementation in Java

纵饮孤独 提交于 2019-12-22 07:18:31
问题 I'm looking to create a basic chess (or failing that, checkers/draughts) engine. After researching the topic I'm fairly confident that I want to use a series of bitboards. I understand the concept at a basic level but I'm having trouble representing them in Java. I've attempted to represent the white pieces of a chessboard as 1 and everything else as 0 using a long: long whitePieces = 0000000000000000000000000000000000000000000000001111111111111111L; But when I print it out I get the

“Isolate” specific Row/Column/Diagonal from a 64-bit number

a 夏天 提交于 2019-11-28 03:58:10
OK, let's consider a 64-bit number, with its bits forming a 8x8 table. E.g. 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 1 0 1 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 0 1 1 0 1 1 1 0 0 1 1 0 1 0 1 0 written as a b c d e f g h ---------------- 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 1 0 1 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 0 1 1 0 1 1 1 0 0 1 1 0 1 0 1 0 Now, what if we want to isolate JUST e.g. column d ( 00100000 ) (or any row/diagonal for that matter) ? Can this be done? And if so, how? HINTS : (a) My main objective here - though not initially mentioned - is raw speed. I

“Isolate” specific Row/Column/Diagonal from a 64-bit number

只谈情不闲聊 提交于 2019-11-27 00:18:23
问题 OK, let's consider a 64-bit number, with its bits forming a 8x8 table. E.g. 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 1 0 1 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 0 1 1 0 1 1 1 0 0 1 1 0 1 0 1 0 written as a b c d e f g h ---------------- 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 1 0 1 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 0 1 1 0 1 1 1 0 0 1 1 0 1 0 1 0 Now, what if we want to isolate JUST e.g. column d ( 00100000 ) (or any row/diagonal for that matter) ? Can this be done?