Questions tagged [bitboard]

For questions about bitboards and using bitboards

Filter by
Sorted by
Tagged with
2 votes
1 answer
57 views

Issue with Magic Bitboards

I have a implemented a similar version to the example given on the chess programming wiki by Tord Romstad. I just changed the random generation and stored the magics in an array. I even kept the old ...
Sheyteo's user avatar
  • 91
2 votes
2 answers
94 views

Why consider all possible combinations of empty/occupied square a sliding piece can move to in attack table generation?

When generating attack tables for a rook, why do we consider all 2^(number of set bits on the mask) potential configurations of empty or occupied squares along the ranks and files where a rook can ...
Gabriel's user avatar
  • 21
0 votes
0 answers
68 views

Difficulty with magic bitboards

I am having some difficulty with magic bitboards, in that multiple blocker bitboards which would result in different attack boards having the same index. I realize this is likely because of one of the ...
Fb_Wdw's user avatar
  • 1
-1 votes
1 answer
63 views

Storing generated moves for a chess engine in Java [closed]

I am in the process of building a chess engine in Java using bitboards. I know C/C++ is more optimal for this but I have no knowledge of either so I'd rather attempt to do it with Java for now. I have ...
soapeater's user avatar
2 votes
2 answers
220 views

Border pieces in Magic Bitboards

I've been trying to understand magic bitboards, but everywhere I've read failed to explain how edge pieces are handled. The pieces at the borders are ignored to save space. So for a bishop at D3, the ...
foderking's user avatar
4 votes
1 answer
727 views

How do Chess Bitboards generate individual moves?

If I have a pawn bitboard like this, for example, 00000000 00000000 00000000 00000000 00001000 00000001 11110110 00000000 generating all of the, say, legal capture moves to the right will perform a ...
AAce3's user avatar
  • 388
2 votes
1 answer
619 views

Bitboard chess engine design

What are the best approaches to designing a chess engine? What classes/structures should it have? How are they connected to each other? I'm building a chess engine but I often find myself overwhelmed. ...
ZED's user avatar
  • 103
4 votes
1 answer
497 views

Move generation for sliding pieces and Hyperbola Quintessence

I'm working on a bitboard-based chess engine at the moment and I have managed to generate pseudo-legal moves for knights, kings and pawns. However, I'm still trying to wrap my head around sliding ...
ZED's user avatar
  • 103
0 votes
1 answer
171 views

Search function for chess engines

I'm creating a bitboard based chess engine in c++ and I'm trying to write the search function. It currently looks something like this double search(Position& pos, int depth, double alpha, double ...
spinosarus123's user avatar
1 vote
1 answer
319 views

Evaluation function in a bitboard based chess engine

How do you go about writing an evaluation function for a bitboard bases chess engine? I want to start of simple and only evaluate based on piece value, and where the pieces stand. For example a knight ...
spinosarus123's user avatar
1 vote
1 answer
375 views

Bitboards and sliding piece attacks

I have been searching about bit boards and piece attacks. The concept of using a bitwise and to find the set of attacked pieces (ie: knightAttackSet & opponentPieces) is really elegant and ...
Papangue's user avatar
  • 113
2 votes
1 answer
637 views

Fastest way to parse a bitboard

I am making a chess engine, and for now I’m working on the move generation. I’m using bitboards, and so for example my magic bit boards file for a knight on d4 is 00000000 00000000 00101000 01000100 ...
S34NM68's user avatar
  • 123
4 votes
1 answer
1k views

How do I complete this implementation of magic bitboards?

I'm currently coding a chess engine in C++, and have run into a bit of trouble with my magic bitboard implementation. So far, I have a function that calculates blockerBoards (all the possible pieces ...
gcahilly's user avatar
2 votes
1 answer
319 views

How can I convert a possible pieces' moves to an actual move in a bitboard?

If I have a bitboard (e.g. for knight squares he can move to) like this: 00000000 00000000 00000000 00000000 00000000 01000000 00100000 N0000000 How can I "convert" it into a move or "...
theclueless's user avatar
1 vote
1 answer
255 views

How do I find bitboard attack maps non-manually?

I am writing a C++ chess engine based on the magic bitboard, where ordering for bitboards is from LSB to MSB in Little-Endian Rank-File mapping. I'd like to have a 6x64 dimension 2D array for all ...
Noah43554's user avatar
1 vote
3 answers
771 views

Fastest way to generate castling moves in a computer chess engine

I am currently developing a Bitboard chess engine using C++. I am in the process of creating the move generator function. I have completed most of it and only the casting part is left. I have used ...
user avatar
3 votes
1 answer
163 views

How do I apply moves (bitboard) and continue searching? My current attempt is throwing a strange error!

Explanation I have a list of all possible current moves in a position. At each node, I want to then generate all possible moves and continue. The problem is that my code is modifying the list of moves ...
Kieran Montgomery's user avatar
1 vote
1 answer
347 views

How to store moves for a magic bitboard system?

I am currently trying to implement magic bitboards into my chess engine. Let's just talk about rooks here. Given a square, what I can currently do is: -Calculate the sliding moves on an empty board. ...
Kieran Montgomery's user avatar
4 votes
2 answers
3k views

Quickly converting board to bitboard representation using python-chess library

I would like to convert a given chess board into its bitboard representation, but my implementation is rather slow. Here is what I'm doing (using the python-chess package): board = chess.Board('...
Arman's user avatar
  • 171
3 votes
1 answer
415 views

Magic Bitboards, Feeding in Randoms - Why have to find magic instead of just loading from disk?

I read about Looking for Magics for Magic Bitboard, they mentioned the method "Feeding in Randoms". As I understand, this method works like this: label RETRY; magic = random();//trial for (all ...
123iamking's user avatar
5 votes
1 answer
535 views

Are these magics wrong?

I am working on my chess engine and wanted to finally implement magic bitboards to get a huge increase in performance. Basically I was writing a method to check if a number can be used as a magic for ...
Finn Eggers's user avatar
2 votes
1 answer
245 views

Can engines use the current pawn structure to refine its search/eval?

As I understand it, engines use so-called "bitboards" to generate the current position & possible moves. I'm wondering if any engine uses the pawn bitboard to refine its search and eval. To ...
Allure's user avatar
  • 26.1k
5 votes
2 answers
940 views

Chess Engine: Generate a Bitboard of Pinned Pieces

I'm currently working on a chess engine and have a pseudo-legal move generator working. I'm looking for a way to efficiently generate a bitboard of pinned pieces, so I could skip them when generating ...
Ori Yonay's user avatar
  • 141
5 votes
3 answers
5k views

What's the right approach of storing moves generated using bitboards?

I am building a chess engine from scratch using bitboards and, so far I am able to generate pawns moves. But, I am stuck on what should I do after finding all possible moves for pawns. Right now the ...
Carlos's user avatar
  • 171
1 vote
1 answer
3k views

Understanding magic bitboard

I have read a lot of stuff about magic bitboard but some stuff is not clear. A lot of authors say to create the move masks for the piece avoiding the border positions. So, for a bishop at D3 the move ...
Duck's user avatar
  • 161
4 votes
2 answers
2k 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 ...
Duck's user avatar
  • 161
7 votes
3 answers
6k views

Representing Moves found via BitBoards, applying them, and removing them

I understand how to find all valid moves for all pieces on the board. For example I know that a certain knight can hit all of the 1's in this board 01000000 00100000 N0000000 00100000 01000000 ...
AndrewGrant's user avatar
9 votes
1 answer
3k views

Find magic numbers for bitboards

I am writing a C++ chess engine and I am looking for magic numbers for Little-Endian Rank-File Mapping bitboards to generate moves for sliding pieces. The rival chess website gives magic numbers but ...
Romain's user avatar
  • 667
12 votes
2 answers
19k views

How to represent chess state with a bitboard

I'm interested in programming a chess engine and using bitboards to represent the state of the game. I know there are a few open source chess engines that use bitboards, but its not so easy to look at ...
axiopisty's user avatar
  • 383