Questions tagged [bitboard]

For questions about bitboards and using bitboards

Filter by
Sorted by
Tagged with
1 vote
0 answers
13 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 ...
user avatar
4 votes
1 answer
85 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 ...
user avatar
  • 133
2 votes
1 answer
212 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. ...
user avatar
  • 103
4 votes
1 answer
222 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 ...
user avatar
  • 103
0 votes
1 answer
77 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 ...
user avatar
1 vote
1 answer
111 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 ...
user avatar
1 vote
1 answer
129 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 ...
user avatar
  • 113
1 vote
0 answers
227 views

Magic bitboards not speeding up my engine

I'm new to writing chess engines but just recently finished my first program. It ran slowly however so I switched over to bitboards, and now to magic bitboards. I used the chess programming wiki a lot....
user avatar
2 votes
1 answer
244 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 ...
user avatar
  • 23
4 votes
1 answer
512 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 ...
user avatar
2 votes
1 answer
163 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 "...
user avatar
1 vote
1 answer
136 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 ...
user avatar
1 vote
3 answers
442 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
144 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 ...
user avatar
1 vote
1 answer
250 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. ...
user avatar
4 votes
2 answers
1k 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('...
user avatar
  • 171
3 votes
1 answer
302 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 ...
user avatar
5 votes
1 answer
387 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 ...
user avatar
2 votes
1 answer
172 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 ...
user avatar
  • 21.7k
5 votes
2 answers
655 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 ...
user avatar
  • 121
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 ...
user avatar
  • 151
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 ...
user avatar
  • 161
4 votes
2 answers
1k 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 ...
user avatar
  • 161
7 votes
3 answers
5k 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 ...
user avatar
9 votes
1 answer
2k 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 ...
user avatar
  • 637
10 votes
2 answers
16k 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 ...
user avatar
  • 363