stellar

Stellar - UCI Chess engine written in C++20
git clone git://git.dimitrijedobrota.com/stellar.git
Log | Files | Refs | README | LICENSE

commit 46627ec50fac592cee9d8616f40d1d5e364d1f23
parent 733fd2ea50dfbd88f6d14dea714bd8a9334998f1
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Sat, 24 Sep 2022 15:25:48 +0200

Generate all other moves

Diffstat:
Msrc/engine.c | 17+++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/engine.c b/src/engine.c @@ -258,10 +258,19 @@ void CBoard_move_generate(CBoard_T self) { while (bitboard) { source = bit_lsb_index(bitboard); bit_pop(bitboard, source); - attack = Piece->attacks(source, occupancy) & - (C64(-1) ^ self->colorBB[color]); - printf("%s: %s; moves: %d\n", Piece->unicode, - square_to_coordinates[source], bit_count(attack)); + attack = Piece->attacks(source, occupancy) & ~self->colorBB[color]; + while (attack) { + target = bit_lsb_index(attack); + if (bit_get(self->colorBB[!color], target)) + printf("%s from %s capture to %s\n", Piece->unicode, + square_to_coordinates[source], + square_to_coordinates[target]); + else + printf("%s from %s move %s\n", Piece->unicode, + square_to_coordinates[source], + square_to_coordinates[target]); + bit_pop(attack, target); + } } } }