feat : add stockfish 17
This commit is contained in:
@@ -30,7 +30,8 @@ import { useChessActions } from "@/hooks/useChessActions";
|
||||
import { playGameStartSound } from "@/lib/sounds";
|
||||
import { logAnalyticsEvent } from "@/lib/firebase";
|
||||
import { useEffect } from "react";
|
||||
import { isWasmSupported } from "@/lib/engine/shared";
|
||||
import { isEngineSupported } from "@/lib/engine/shared";
|
||||
import { Stockfish16_1 } from "@/lib/engine/stockfish16_1";
|
||||
|
||||
interface Props {
|
||||
open: boolean;
|
||||
@@ -69,10 +70,14 @@ export default function GameSettingsDialog({ open, onClose }: Props) {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!isWasmSupported()) {
|
||||
setEngineName(EngineName.Stockfish11);
|
||||
if (!isEngineSupported(engineName)) {
|
||||
if (Stockfish16_1.isSupported()) {
|
||||
setEngineName(EngineName.Stockfish16_1Lite);
|
||||
} else {
|
||||
setEngineName(EngineName.Stockfish11);
|
||||
}
|
||||
}
|
||||
}, [setEngineName]);
|
||||
}, [setEngineName, engineName]);
|
||||
|
||||
return (
|
||||
<Dialog open={open} onClose={onClose} maxWidth="md" fullWidth>
|
||||
@@ -81,9 +86,10 @@ export default function GameSettingsDialog({ open, onClose }: Props) {
|
||||
</DialogTitle>
|
||||
<DialogContent sx={{ paddingBottom: 0 }}>
|
||||
<Typography>
|
||||
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.
|
||||
Stockfish 17 Lite is the default engine if your device support its
|
||||
requirements. It offers the best balance between speed and strength.
|
||||
Stockfish 17 is the strongest engine available, note that it requires
|
||||
a one time download of 75MB.
|
||||
</Typography>
|
||||
<Grid
|
||||
marginTop={4}
|
||||
@@ -109,9 +115,7 @@ export default function GameSettingsDialog({ open, onClose }: Props) {
|
||||
<MenuItem
|
||||
key={engine}
|
||||
value={engine}
|
||||
disabled={
|
||||
engine !== EngineName.Stockfish11 && !isWasmSupported()
|
||||
}
|
||||
disabled={!isEngineSupported(engine)}
|
||||
>
|
||||
{engineLabel[engine]}
|
||||
</MenuItem>
|
||||
@@ -164,6 +168,8 @@ export default function GameSettingsDialog({ open, onClose }: Props) {
|
||||
}
|
||||
|
||||
const engineLabel: Record<EngineName, string> = {
|
||||
[EngineName.Stockfish17]: "Stockfish 17 (75MB)",
|
||||
[EngineName.Stockfish17Lite]: "Stockfish 17 Lite (6MB)",
|
||||
[EngineName.Stockfish16_1]: "Stockfish 16.1 (64MB)",
|
||||
[EngineName.Stockfish16_1Lite]: "Stockfish 16.1 Lite (6MB)",
|
||||
[EngineName.Stockfish16NNUE]: "Stockfish 16 (40MB)",
|
||||
|
||||
Reference in New Issue
Block a user