Questions tagged [bitboard]

A bitboard is a data structure commonly used in computer systems that play board games.

-2
votes
0answers
40 views

Hexagonal bitboard algorithm [on hold]

I wrote a board game engine that based on hexagonal board. My board doesn’t have standard layout and it’s being assembled by code per level. Look at these images for hexagonal board reference:  ...
0
votes
1answer
18 views

Bitboard algorithms for board sizes greater than 64?

I know the Magic BitBoard technique is useful for modern games that are on a n 8x8 grid because you it aligns perfectly with a single 64-bit integer, but is the idea extensible to board sizes greater ...
0
votes
1answer
21 views

Bitboard: counting elements with neighbours

In order to represent the state of a 2D board game, I am using bitboards with 16bits unsigned integers. The state is encoded with 1 for piece presence and 0 else. What is the bitboard way to count ...
2
votes
1answer
95 views

Chessprogramming: how to get a single move out of a bitboard attack-mask most efficently

How can I get efficiently a single move out of an attack mask, that looks like this: ....1... 1...1... .1..1..1 ..1.1.1. ...111.. 11111111 ..1.11.. .1..1.1. for a queen. What I've done in the past, ...
1
vote
1answer
73 views

How to display a bitboard derived from binary literals?

I'm trying to print out a chess game which I am implementing using bitboards. I'm having trouble visualizing how would I go about display the 8x8 grid with the pieces for play. Here's the link to ...
0
votes
1answer
82 views

Converting C++ function to C#

I'm trying to convert c++ funtion to c#, but I'm failing for the second straight hour. Need help:/ The function is taken from this question bool haswon(unsigned __int64 newboard) { unsigned ...
0
votes
1answer
194 views

Sliding Piece Generation in Chess Engine

So I've been having some trouble wrapping my head around an issue. I'm currently writing a bitboard based chess engine in Java (its been a ride figuring everything out). So far all of the pawn/king/...
2
votes
1answer
176 views

How to properly use bitboards

I'm wondering what is the correct way to implement bitboards into a chess engine. So far I did some research on the basics of chess engine programming and took some notes, mostly stuff such as minimax,...
0
votes
1answer
162 views

Swift 3 uint64 overflows when trying to assign 64 bit integer

I'm trying to implement bitboards in Swift and am trying to store a 64bit integer into a UInt64 and get an overflow error. var white_queen_bb:uint64 = ...
0
votes
1answer
138 views

Given a chess app built with magic bitboard how do I check for checkmate?

OK, I have this chess app built with bitboard and I want to check if a given move put the opponent pieces in checkmate. Verifying a check situation is easy. You build the bitmask of the enemy pieces' ...
6
votes
1answer
405 views

Not understanding how the bitboard technique works for chess boards

My brain is smoking trying to understand the mechanics of this bitboard technique. In order to make it simple, lets imagine that, instead of chess and a lot of complex piece movements, we have a game ...
0
votes
1answer
145 views

Building a chess using magic bitboard… how do I know if the movement is valid

OK I have read a lot of things on the web most of them using Java that doesn't have unsigned int. I am working on Objective-C that has unsigned int. Lets consider the following scenario. The board ...
2
votes
1answer
76 views

Bitboard: hexadecimal to binary conversion

I am initializing bitboards for chess programming. However, when I initialize the black bitboards, the binary output is incorrect for some reason. The following is the code: #include <stdint.h>...
0
votes
2answers
99 views

Flip one dimensional array board representation about the x axis

I am in the midst of programming a chess AI, and have encountered an issue with my implementation of piece-square tables. Since I only want to have one piece-square table per side, I need a function ...
0
votes
2answers
673 views

Recognising a chess piece with bitboards

When the chessboard is stored in a variety of bitboards, how do modern chess engines recognise what type/side piece is situated on a particular cell? I'm having problems with this, since to find out ...
1
vote
2answers
344 views

Generating individual moves from a bitboard of moves

In my chess engine, that uses bitboards for representing the board's state, generates a chunk of pseudo-legal moves in one go, a bitboard being the result. For example: Pawns: A little bitboard ...
-3
votes
1answer
119 views

What is the maximum strength of a chess engine with a board representation using an 8 by 8 array?

I am trying to program my first chess engine, and I am using chessprogramming.wikispaces.com as a resource. My first attempt was to use bitboards considering their performance perks and for the fact ...
4
votes
3answers
5k views

Bitwise (Bitshift) operations on 64-bit integers in C++

I'm trying to deal with bitboards, which requires me to set a particular bit in a 64-bit unsigned integer. To set bit i, I perform a bitwise OR with the bitboard in question, with a left shifted ...
0
votes
1answer
628 views

How to deal with very big Bitboards

I'm working on a 2-player board game (e.g. connect 4), with parametric board size h, w. I want to check for winning condition using hw-sized bitboards. In game like chess, where board size is fixed, ...
0
votes
2answers
345 views

Algorithm Trax Winning Condition

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 ...
1
vote
1answer
140 views

BitBoard for Checkers in C#

I have studied bitboard but have failed to find an example on what the bitboard coding would look like in c#. If someone would be so kind to illustrate how a checkers board (8x8) would be programmed ...
1
vote
1answer
175 views

Fastest bitboard transposition (5x5)

For a puzzle-solver I'm writing, I'm looking for the fastest algorithm (minimal number of bit operations) to transpose a 5x5 bitboard with 2 bits per square in the puzzle, so: 00 01 02 03 04 05 06 07 ...
1
vote
2answers
258 views

How can i use a unsigned 64 bits variables in Bits Operations in Clojure?

I have the following code: (defn BitScanReverse [^Long bit-board] (loop [value bit-board r 0] (cond (> value 0x00000000FFFFFFFF) (recur (unsigned-bit-shift-right value 32) (+ r 32)) ...
0
votes
1answer
76 views

update attack bit board when one attack is updated

This is just a principle. I would like the attacked bitboard to be updated when one of the attacks bitboards (knight, bishop or pawn) is altered without having to repeat line 1. Is this possible? what ...
2
votes
4answers
251 views

Is there a cheap way to “mirror” the bits in a byte?

When trying to test for reachability on a straight line without looping, you can use Bitboard representation. Imagine chess, a row or column of the board represented as a byte and the question if a ...
0
votes
2answers
97 views

Shifting only 1 bit in an integer by a specific number of places

I am creating a chess program and for the board representation I am using bitboards. The bitboard for white pawns looks like this: whitePawns=0x000000000000FF00; Now, if I want to move the white ...
5
votes
2answers
2k views

Chess bitboard implementation in Java

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 ...
0
votes
2answers
365 views

Rotating a bitboard

I'm working with 24-bit bitboards in Java representing a game board of the following form: 00 01 02 03 04 05 06 07 08 09 10 11 XX 12 13 14 15 16 17 18 19 20 21 22 23 Note that the board has a hole ...
0
votes
2answers
498 views

Chess: bitscanning

I'm writing a chess engine in C# with magic bitboards and it's very slow right now. It takes 2 minutes to calculate perft 6 (119,060,324 positions) from the initial position when other engines can do ...
0
votes
0answers
596 views

Using bitboards for Checkers development in C++

I got advice that it's good to implement Checkers using bitboards. After I read this tutorial http://www.3dkingdoms.com/checkers/bitboards.htm I'm a bit confused. I understand that bitboards are very ...
0
votes
1answer
232 views

Bitboard bitwise operations on 64 bit integers on iPhone 4 and 5?

I've got a rather interesting problem. I'm writing a chess engine using bitboards for iOS 7 which I want to work on the iPhone 4, 4s, 5, and 5s. Up till now I was doing all my testing in the iOS 64bit ...
1
vote
1answer
534 views

generating bitboard masks for move

I'm trying to understand how works bitboard representation in chess programming and I can't find usefull information (or just can't translate it correctly ^^) about one detail. My question is, how to ...
0
votes
2answers
223 views

Bitboard with connect 5 game?

I need your help to know if it's possible to use a bitboard for a connect 5 game. Because I saw a lot of examples for connect 4 games but nothing if the board is very large such as 15x15 or 19x19. I ...
2
votes
1answer
193 views

Chess Bitboard Population [closed]

In some bitboard chess engines piece bitboards are initialized as follows: white_pawns = 0x000000000000ff00 black_pawns = 0x00ff000000000000 white_knights = 0x000000000000042 black_knights = ...
7
votes
3answers
4k views

Sliding move generation using magic bitboard

This is a question regarding the big picture of how to validate a sliding piece move in chess using magic bitboards. Just to clarify, I am not asking how magic bitboards work internally. Now, some ...
3
votes
4answers
2k views

Bitboard representation for nine men morris game

I'm writing a Nine Men's Morris game in Java and have already the implemented the game rules and an AI using negamax. However, the game is based on arrays and move generation takes quite some time ...
2
votes
4answers
1k views

Efficient board representation for strategy board game AI

Would a bitboard representation still be as effective in a dumbed-down chess-like strategy game which has less than 64 positions or would a simpler array based mailbox implementation be more practical?...
29
votes
9answers
2k views

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

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 ...
4
votes
2answers
859 views

How to iterate over a bit value?

I want to build a chessboard via bitboard system. Starting with 12 bitboards i want to display a table (chessboard), during loop/iteration a piece must be drawn. How do i loop through all bitvalues? ...
14
votes
2answers
8k views

Test if a bitboard have only one bit set to 1

I have a bitboard and I want to check in C if there is ONLY one bit set to 1. #include <stdint.h> typedef uint64_t bboard; bboard b = 0x0000000000000010; if (only_one_bit_set_to_one (b)) // in ...
2
votes
2answers
4k views

Chess Board representation - Engine [closed]

I'm working on my own chess engine in C#. Actually I'm searching bugs on my move generator, but I realized that my actual chess system is too slow (even 21 minutes on perft(6)). Here is my Github ...
2
votes
1answer
714 views

Can't write range based for with non-member begin and end functions

I'm writing a code that uses bitboards. since iterating on all bits of a bitboard is pretty common action, I decided to write some iterator class, and to use c++0x's range based loops. However, g++ (...
3
votes
2answers
361 views

Ray attacks on a bitboard

I'm trying to calculate ray attacks given the index of a 64-bit Long bitboard representation: (defn se [board index] "Produces a ray attack from the indexed bit in the south-east direction" (...