Closed fqhd closed 7 months ago
I’d be quite surprised if this is the case. Do you have a minimal reproduction for me which I can check later ?
Oh you are talking about the direction? The direction obviously doesn’t change.
Each bit of the bitboard is representing a square on the chess board.
which matches these squares.
White should be on the bottom. Not sure how if my stringification is currently displaying it on the bottom as well. Gotta check that later, but one side will always be on the bottom and the other on the top. The players turn shouldn’t have an effect on that
Running the unit tests I get this representation.
For a bitboard which has the Square A1 set.
Bitboard::fromSquare(Square::underlying::SQ_A1);
../tests/bitboard.cpp:297: SUCCESS: CHECK( static_cast<std::string>(str1) == str1 ) is correct!
values: CHECK( 00000000
00000000
00000000
00000000
00000000
00000000
00000000
10000000
== 0x560cc950f420 )
and this for Square A2
Bitboard::fromSquare(Square::underlying::SQ_A2);
../tests/bitboard.cpp:301: SUCCESS: CHECK( static_cast<std::string>(str2) == str2 ) is correct!
values: CHECK( 00000000
00000000
00000000
00000000
00000000
00000000
00000000
01000000
== 0x560cc950f498 )
So I don't see anything wrong atm.
Oh you are talking about the direction? The direction obviously doesn’t change.
Each bit of the bitboard is representing a square on the chess board.
which matches these squares.
White should be on the bottom. Not sure how if my stringification is currently displaying it on the bottom as well. Gotta check that later, but one side will always be on the bottom and the other on the top. The players turn shouldn’t have an effect on that
Interesting okay. Then what is the point of having board.them and board.us?
To get the underlying bitboards to do operations on them?
You can get your bitboard (us) and their (them) bitboard. Since ~usisn't equivalent to
them` you need another method. They are not just for visualization but are at the low level the basis of how moves are generated and can represent the board in an computational efficient way. https://www.chessprogramming.org/Bitboards
Yes but there is a color parameter that you pass to both us and them. If the direction of the board doesn't change when calling us or them(aka white is always on the bottom), then what's the point of having two separate functions?
Ah, mh good point.. I think some time ago it didn't take a color parameter, so yeah, might also be more self explanatory if you write board.them(c);
instead of board.us(~c);
perhaps?
I see okay, personally I suggest having just one function Bitboard getBitboard(Color color) const;
function to avoid confusion? maybe that's a good change idk
I imagine Board::us() is supposed to return the bitboard from the perspective of the player that currently has to play a move. This is not what is happening, it seems that no matter who's turn it is, Board::us() will always make black appear on the bottom and white on top(both on the stringified version of Board::us() and the actual bitboard data itself, I checked manually). Same thing applies to Board::them(), the person's turn has no effect on the direction of the bitboard returned.