Skip to main content
Filter by
Sorted by
Tagged with
2 votes
0 answers
143 views

I'm trying to create a chess bot. I'm using bit-boards to represent the board and pieces. I read online from several sources that using PEXT for sliding piece lookups makes your code really fast. I ...
Michael's user avatar
  • 27
0 votes
0 answers
76 views

I know that to store the knight's attacks for example I begin by initializing an array of 64 uint64s representing all the possible knight attacks and fill it up then whenever I need the move of a ...
ns8's user avatar
  • 1
2 votes
1 answer
119 views

The shape I am looking for looks like this: I have two bitboards that represent two players in the game Connect 4. The bits that are used are bits from 0 to 48, so 49 bits in total. The ...
Alex's user avatar
  • 6,221
1 vote
0 answers
64 views

I have two bitboards that represent two players in the game Connect 4. The bits that are used are bits from 0 to 48, so 49 bits in total. The representation looks like this: 6 13 20 27 34 41 48 55 ...
Alex's user avatar
  • 6,221
-1 votes
1 answer
107 views

The transposition table uses keys from the position of player 0 and player 1 from bitboards and includes the player turn at the end, I did that to guarantee unique keys for all states. But this seems ...
Alex's user avatar
  • 6,221
1 vote
1 answer
84 views

I have the bitboard representation like this for each player: 00000000 0000000 0000001 0000010 0000100 0010001 0000101 0000000 0000001 00000000 0000000 0000000 0000001 0000011 0001110 0000010 0000000 ...
Alex's user avatar
  • 6,221
1 vote
0 answers
83 views

Am am currently coding up a somewhat chess-like game that includes a "pushing" mechanic. Getting an efficient algorithm for this seems to be elusive. Here are the details. I represent an NxM ...
Marcell's user avatar
  • 51
1 vote
1 answer
204 views

The function below is attempting to create a bitboard with the set bit being in the Nth position, by bitshifting 0x1 N times to achieve desired result. N is being given by the 1-6th least significant ...
Michael Haney's user avatar
1 vote
0 answers
151 views

I'm currently working to improve a chess engine in python. more specifically I'm working on the move generation of sliding pieces, like rooks and bishops. originally I used this loop function for both ...
Smillyone's user avatar
-1 votes
1 answer
230 views

I'm programming a chess engine in Java and I would like to represent all pieces positions in one variable called bitmap or bitboard. In C++ I would simply use unsigned long, or so-called uint64_t. But ...
Radoslav Khun's user avatar
1 vote
0 answers
229 views

For context: https://www.chessprogramming.org/Looking_for_Magics are the magic numbers I am talking about Hey, I would like to map availabilty of king attacks to low order 8 bits. For example, king's ...
user avatar
0 votes
1 answer
223 views

I'm currently trying to print a ulong data type as 8x8 grid of binary bits since the ulong data type has 8 bytes - 64 bits. While trying to do so, I keep getting a bit turned on with 32-bit offset. To ...
mich abay's user avatar
1 vote
1 answer
40 views

I have been converting some Tic Tac Toe code to use bitboard so I can implement an AI opponent. As part of the test code I wanted to conduct a bitwise AND comparison to check if the moves are valid, ...
Dave022's user avatar
  • 43
2 votes
1 answer
257 views

I've been trying to understand magic bitboards for attack generation in chess engines. I think I roughly understand them, but one thing everyone fails to explain properly is how to handle blockers ...
foderking's user avatar
4 votes
2 answers
5k views

I am writing a chess engine, and I'm understanding how chess engines store game positions (in 64-bit bitboards) and how to generate moves from them. When you get your final bitboard of moves, how do ...
PooDumpling's user avatar
0 votes
1 answer
258 views

I am trying to find a fast way to rotate and reflect a 5x5 board to store it in a transposition table. The board is represented as a bitboard as they are very fast. The bitboard is represented like ...
JackRubiralta's user avatar
0 votes
1 answer
145 views

I'm writing a chess engine in Java and using bitboards to represent the board (12 64-bit numbers). The size of an instance of this class(its retained size) is 152Bytes according to IntelliJ debugger. ...
Kaleab_G's user avatar
3 votes
1 answer
198 views

I am trying to find a quick and fast way to check for alignment of 5 bits in a 6x6 board in all directions (diagonal, horizontal, vertical). The board is represented as a bitboard as they are very ...
JackRubiralta's user avatar
0 votes
2 answers
76 views

I'm writing a chess engine, and am trying to make it as fast as possible, so I'm using bitboards to represent each type of piece. I was printing out the number of different board states at each plie (...
user avatar
-1 votes
1 answer
142 views

I recently started working on my school project which is writing a chinese chess game with a computer player in Java, I want to represent the board with bitboards, however since the board is 9x10, ...
Orisade2003's user avatar
1 vote
1 answer
219 views

I'm programming a 4x4 board game in C++ using bitboards in a 64-bit machine. I only need 16 bits to implement the board. Should I use: uint16_t - to reduce used space? uint64_t - if operations are(?) ...
André Dias's user avatar
0 votes
1 answer
287 views

I have 2 separate boards for 2 players: X and O. Now I'd like to make sure if an entered position (int x, int y) is valid but I've got no idea of how should I convert it to bitboard representation and ...
Besynnerlig's user avatar
1 vote
1 answer
90 views

Problem Hello, this is my first stack overflow question. I'm using Bit-boards to represent board states in my chess engine. Currently I have a bit-board class like so: class Bitboard { public: ...
Oxyn's user avatar
  • 17
3 votes
1 answer
576 views

For example, all white pawns' attacks are either generated by shifting 7 or 9 bits to the left (or right, I could be mistaken, but I think it's easy to get the gist). So the white pawn bitboard that ...
felipebubu's user avatar
0 votes
1 answer
172 views

I am working with a game state which is received as a string and needs to be converted into a BitBoard. I believe I have a function that accomplishes that now, but want to know how I can optimize it ...
Baiano42's user avatar
1 vote
1 answer
1k views

I am currently trying to make my chess engine faster, and am looking at implementing magic bitboards for my sliding piece attack generation. I am using a bitboard representation of the chessboard with ...
user avatar
1 vote
1 answer
709 views

I don't have too much knowledge about bitboards and bit operations and I got some examples of bitboard chess engines from Github. And I like to know if anyone can help me with a problem. How can I ...
JRamos29's user avatar
  • 890
-1 votes
1 answer
466 views

I have been trying to come up with a funtion were given a int it would modify a bit at a given position using bitwise operations: For example: modify_bit(int, pos) modify_bit(0b10000, 1) should return ...
Jalrux's user avatar
  • 5
3 votes
1 answer
6k views

I am making a bitboard based chess engine and I would like to ask - assuming that I made a bitboard to every piece, what do I do with it? I read a little bit about some techniques like if you shift ...
Michael's user avatar
  • 61
1 vote
1 answer
245 views

Since Stockfish is the highest rated chess engine, and it's known to be quite CPU-effiecient I decided to open its source code and try to understand and see how it works. I came across this snippet of ...
user avatar
2 votes
1 answer
151 views

I want to transform a UCI-move into bitboard. for example a2a3 -> 32768, 8388608 I need to assign [7,6,...,0] to [a,b,...,h] so that for each letter i have the assigned number(n) to calculate 2^n ...
Jay Osayi's user avatar
1 vote
0 answers
1k views

I have been working on a chess engine for a while and its fairly strong (about 2700 CCRL) and was wondering the following thing: most top-level chess engines use bitboards. they are basically just 64-...
Finn Eggers's user avatar
2 votes
1 answer
54 views

I'm coding a chess engine using bitboards and I wanna make an extensible API for the bitboards initializer, that would allow me to add more variants like chess960 in future. So i came up with the ...
big's user avatar
  • 73
0 votes
1 answer
237 views

i think this question has not been asked yet. Thing is, in chess we use bitboards to speed move-generation-cycles up by representing a position by a bit=1 and other by a bit=0. In chess we have 8*8 ...
Plagueis's user avatar
  • 183
0 votes
1 answer
236 views

Very new to C#, so this could be a silly question. I am working with alot of UInt64's. These are expressed as hex right? If we look at its binary representation, can we return such an array that if ...
Kieran Montgomery's user avatar
4 votes
0 answers
282 views

i'm actually trying to create an AI that can play a board game. My problem is that the boardgame is using a 9x9 square, so i can't use a 64bitboards like usually. Is there any way on how to use more ...
Fanto's user avatar
  • 367
0 votes
1 answer
196 views

What I Am Doing: I am writing a chess engine in Swift. One of the most important parts of writing a strong chess engine is the ability to generate as many possible future board positions in as little ...
David Chopin's user avatar
  • 2,574
3 votes
1 answer
475 views

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 ...
David Chopin's user avatar
  • 2,574
3 votes
1 answer
2k views

I am building a chess engine in Swift based off a tutorial written in Java. In the tutorial, Java's signed 64 bit integer long has a static method called reverse(long i) that "Returns the value ...
David Chopin's user avatar
  • 2,574
2 votes
0 answers
2k views

I have made two very similar Othello AIs. In the first one, the board is represented as an array of length 100 (10x10) where the 8x8 board is represented in the "middle" of the array and the ...
Varun Vejalla's user avatar
0 votes
1 answer
149 views

Essentially im trying to create a connect four Ai and i came across an article which uses bit boards to optimize making moves and checking for wins. Essentially i took a few methods from a git hub ...
Julian Carrier's user avatar
3 votes
0 answers
376 views

I am making an AI following this article. The basic idea is using bitboards to make a extremely fast protocol for making modifications to the board and permutating through possible game outcomes. ...
Julian Carrier's user avatar
2 votes
1 answer
786 views

I am struggling to find an efficient way of calculating a 64-bit representation of a square's diagonals. The game in question is a board game called Othello or Reversi. I am currently working on a ...
Imak's user avatar
  • 99
1 vote
1 answer
642 views

I want to implement a 9x9 board game similar to chess, that has only rook-like moving pieces. Performance is crucial since I want to develope an AI also. I read articles about bitboards, an efficient ...
realMisterLinux's user avatar
1 vote
0 answers
488 views

I am writing a reinforcement learning checkers engine, and I've reached a performance roadblock. The network is capable of learning quickly on my machine, but my game/mcts implementation is so slow ...
basket's user avatar
  • 181
4 votes
3 answers
880 views

I need to count the number of trailing and leading zeros in a numpy uint64 variable, so right now I'm doing it like this: # n > 0 n = np.uint64(100) s = np.binary_repr(n) trail_zeros = len(s) - ...
Fernando's user avatar
  • 7,925
0 votes
1 answer
244 views

I am programming a chess ai. I ran into a problem when I want to move the bits from the king_span to the left. When I move the bits up to 45 places, it works fine. If I want to move them more than 45 ...
John Dornbierer's user avatar
0 votes
1 answer
748 views

I am in the middle of programming a chess ai. I have run into a problem when trying to calculate all possible diagonal moves for the bishop. I think the problem lies within the function: reverse_bits()...
John Dornbierer's user avatar
1 vote
2 answers
3k views

I want to program a chess engine using bitboards. Because I am not very familiar with bitboards I am trying to figure out first how to use them. I wrote a small function which should print the ...
John Dornbierer's user avatar
7 votes
4 answers
683 views

In many board games (like checkers, go and othello/reversi) each square can be represented by three states: white, black or empty. 8x8 boards in such game engines are usually represented as two ...
Andriy Makukha's user avatar