Elo play level selection (#17)

* feat(play): switch engine UI and logic from skill level to Elo rating (100–3200)
This commit is contained in:
titanium_machine
2025-05-08 23:47:09 +02:00
committed by GitHub
parent 9245125e13
commit 1ac075f1f0
5 changed files with 40 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
import { useAtomValue } from "jotai";
import {
engineSkillLevelAtom,
engineEloAtom,
gameAtom,
playerColorAtom,
isGameInProgressAtom,
@@ -24,7 +24,7 @@ export default function BoardContainer() {
const { white, black } = usePlayersData(gameAtom);
const playerColor = useAtomValue(playerColorAtom);
const { makeMove: makeGameMove } = useChessActions(gameAtom);
const engineSkillLevel = useAtomValue(engineSkillLevelAtom);
const engineElo = useAtomValue(engineEloAtom);
const isGameInProgress = useAtomValue(isGameInProgressAtom);
const gameFen = game.fen();
@@ -40,10 +40,7 @@ export default function BoardContainer() {
) {
return;
}
const move = await engine.getEngineNextMove(
gameFen,
engineSkillLevel - 1
);
const move = await engine.getEngineNextMove(gameFen, engineElo);
if (move) makeGameMove(uciMoveParams(move));
};
playEngineMove();