fixed promotion menu for black

This commit is contained in:
2024-09-15 19:07:08 +02:00
parent a649db77ef
commit 5209dfec92
6 changed files with 34 additions and 23 deletions

View File

@ -134,3 +134,11 @@ struct gameState_t newGameState(uint_least64_t *board, char *FEN) {
gameState.halfMoveCounter = atoi(++FEN);
return gameState;
}
uint_least8_t getFile(const uint_least8_t field) {
return field % BOARD_SIZE;
}
uint_least8_t getRank(const uint_least8_t field) {
return field / BOARD_SIZE;
}

View File

@ -23,8 +23,8 @@ void printPieceMask(uint_least64_t mask) {
}
void fieldToString(uint_least8_t field, char *output) {
output[0] = 'a' + field % BOARD_SIZE;
output[1] = '0' + BOARD_SIZE - field / BOARD_SIZE;
output[0] = 'a' + getFile(field);
output[1] = '0' + BOARD_SIZE - getRank(field);
output[2] = '\0';
}