aboutsummaryrefslogtreecommitdiff
path: root/src/board.c
blob: bc5855fa36fa030ece16d47e9ffa9664e3d7bf0b (plain)
1
2
3
4
5
6
7
8
9
10
#include "board.h"

BYTE notation_to_index(char file, int rank) {
  return (rank - 1) * 8 + (file - 'a');
}

void index_to_notation(BYTE index, char notation[2]) {
  notation[0] = (index & 0b0111) + 'a';
  notation[1] = (index >> 3) + '1';
}