feat : add stockfish 16.1

This commit is contained in:
GuillaumeSD
2024-09-30 02:01:07 +02:00
parent 2baf9b76ad
commit 94b7c9d9f7
25 changed files with 110 additions and 47 deletions

View File

@@ -12,7 +12,7 @@ export const boardOrientationAtom = atom(true);
export const showBestMoveArrowAtom = atom(true);
export const showPlayerMoveIconAtom = atom(true);
export const engineNameAtom = atom<EngineName>(EngineName.Stockfish16);
export const engineNameAtom = atom<EngineName>(EngineName.Stockfish16_1Lite);
export const engineDepthAtom = atom(16);
export const engineMultiPvAtom = atom(3);
export const evaluationProgressAtom = atom(0);

View File

@@ -21,8 +21,8 @@ import {
} from "../analysis/states";
import ArrowOptions from "./arrowOptions";
import { useAtomLocalStorage } from "@/hooks/useAtomLocalStorage";
import { Stockfish16 } from "@/lib/engine/stockfish16";
import { useEffect } from "react";
import { isWasmSupported } from "@/lib/engine/shared";
interface Props {
open: boolean;
@@ -44,7 +44,7 @@ export default function EngineSettingsDialog({ open, onClose }: Props) {
);
useEffect(() => {
if (!Stockfish16.isSupported()) {
if (!isWasmSupported()) {
setEngineName(EngineName.Stockfish11);
}
}, [setEngineName]);
@@ -56,9 +56,9 @@ export default function EngineSettingsDialog({ open, onClose }: Props) {
</DialogTitle>
<DialogContent sx={{ paddingBottom: 0 }}>
<Typography>
Stockfish 16 Lite (HCE) is the default engine. It offers the best
balance between speed and strength. Stockfish 16 is the strongest
engine available, note that it requires a one time download of 40MB.
Stockfish 16.1 Lite is the default engine. It offers the best balance
between speed and strength. Stockfish 16.1 is the strongest engine
available, note that it requires a one time download of 64MB.
</Typography>
<Grid
marginTop={4}
@@ -86,9 +86,7 @@ export default function EngineSettingsDialog({ open, onClose }: Props) {
key={engine}
value={engine}
disabled={
engine.includes("stockfish_16")
? !Stockfish16.isSupported()
: false
engine !== EngineName.Stockfish11 && !isWasmSupported()
}
>
{engineLabel[engine]}
@@ -129,7 +127,9 @@ export default function EngineSettingsDialog({ open, onClose }: Props) {
}
const engineLabel: Record<EngineName, string> = {
[EngineName.Stockfish16_1]: "Stockfish 16.1 (64MB)",
[EngineName.Stockfish16_1Lite]: "Stockfish 16.1 Lite (6MB)",
[EngineName.Stockfish16NNUE]: "Stockfish 16 (40MB)",
[EngineName.Stockfish16]: "Stockfish 16 Lite (HCE)",
[EngineName.Stockfish16NNUE]: "Stockfish 16 (40MB download)",
[EngineName.Stockfish11]: "Stockfish 11",
};

View File

@@ -29,8 +29,8 @@ import {
import { useChessActions } from "@/hooks/useChessActions";
import { playGameStartSound } from "@/lib/sounds";
import { logAnalyticsEvent } from "@/lib/firebase";
import { Stockfish16 } from "@/lib/engine/stockfish16";
import { useEffect } from "react";
import { isWasmSupported } from "@/lib/engine/shared";
interface Props {
open: boolean;
@@ -69,7 +69,7 @@ export default function GameSettingsDialog({ open, onClose }: Props) {
};
useEffect(() => {
if (!Stockfish16.isSupported()) {
if (!isWasmSupported()) {
setEngineName(EngineName.Stockfish11);
}
}, [setEngineName]);
@@ -81,10 +81,9 @@ export default function GameSettingsDialog({ open, onClose }: Props) {
</DialogTitle>
<DialogContent sx={{ paddingBottom: 0 }}>
<Typography>
Stockfish 16 Lite (HCE) is the default engine. It offers the best
balance between speed and strength. Stockfish 16 is the strongest
engine available, but please note that it requires a one time download
of 40MB.
Stockfish 16.1 Lite is the default engine. It offers the best balance
between speed and strength. Stockfish 16.1 is the strongest engine
available, note that it requires a one time download of 64MB.
</Typography>
<Grid
marginTop={4}
@@ -112,9 +111,7 @@ export default function GameSettingsDialog({ open, onClose }: Props) {
key={engine}
value={engine}
disabled={
engine.includes("stockfish_16")
? !Stockfish16.isSupported()
: false
engine !== EngineName.Stockfish11 && !isWasmSupported()
}
>
{engineLabel[engine]}
@@ -168,7 +165,9 @@ export default function GameSettingsDialog({ open, onClose }: Props) {
}
const engineLabel: Record<EngineName, string> = {
[EngineName.Stockfish16_1]: "Stockfish 16.1 (64MB)",
[EngineName.Stockfish16_1Lite]: "Stockfish 16.1 Lite (6MB)",
[EngineName.Stockfish16NNUE]: "Stockfish 16 (40MB)",
[EngineName.Stockfish16]: "Stockfish 16 Lite (HCE)",
[EngineName.Stockfish16NNUE]: "Stockfish 16 (40MB download)",
[EngineName.Stockfish11]: "Stockfish 11",
};

View File

@@ -6,6 +6,8 @@ import { atom } from "jotai";
export const gameAtom = atom(new Chess());
export const gameDataAtom = atom<CurrentPosition>({});
export const playerColorAtom = atom<Color>(Color.White);
export const enginePlayNameAtom = atom<EngineName>(EngineName.Stockfish16);
export const enginePlayNameAtom = atom<EngineName>(
EngineName.Stockfish16_1Lite
);
export const engineSkillLevelAtom = atom<number>(1);
export const isGameInProgressAtom = atom(false);