feat : add move classification

This commit is contained in:
GuillaumeSD
2024-03-04 01:56:17 +01:00
parent 9d11b0006e
commit 4975ecfdd1
22 changed files with 13872 additions and 89 deletions

View File

@@ -1,13 +1,18 @@
import { LineEval } from "@/types/eval";
import { EvaluateGameParams, LineEval } from "@/types/eval";
import { Game } from "@/types/game";
import { Chess } from "chess.js";
export const getFens = (game: Chess): string[] => {
export const getEvaluateGameParams = (game: Chess): EvaluateGameParams => {
const history = game.history({ verbose: true });
const fens = history.map((move) => move.before);
fens.push(history[history.length - 1].after);
return fens;
const uciMoves = history.map(
(move) => move.from + move.to + (move.promotion || "")
);
return { fens, uciMoves };
};
export const getGameFromPgn = (pgn: string): Chess => {