import { parseFen, sq } from '@datamoc/mw_games/board';
// Scholar's mate position, black to move, every castling right still on the books
const state = parseFen('r1bqkbnr/pppp1Qpp/2n5/4p3/2B1P3/8/PPPP1PPP/RNB1K1NR b KQkq - 0 4');
console.log(state.turn); // 'black'
console.log(state.board[sq('f7')]?.side); // 'white' - the queen that just gave check
Reads a position in Forsyth-Edwards Notation - the shape puzzles come in.
Placement, side to move, castling rights and the en passant square are read; the halfmove clock and move number are not (draw claims are out of scope), and both kings must be present or there is nothing to judge.