feat : add multi threaded stockfish 16

This commit is contained in:
GuillaumeSD
2024-03-09 02:26:23 +01:00
parent 9b70140b83
commit 0ffba8c6c7
9 changed files with 89 additions and 28 deletions

View File

@@ -5,6 +5,34 @@
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"], "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"cleanUrls": true, "cleanUrls": true,
"trailingSlash": false, "trailingSlash": false,
"predeploy": ["npm run lint", "npm run build"] "predeploy": ["npm run lint", "npm run build"],
"headers": [
{
"source": "/",
"headers": [
{
"key": "Cross-Origin-Embedder-Policy",
"value": "require-corp"
},
{
"key": "Cross-Origin-Opener-Policy",
"value": "same-origin"
}
]
},
{
"source": "/engines/stockfish-wasm/stockfish-nnue-16.js",
"headers": [
{
"key": "Cross-Origin-Embedder-Policy",
"value": "require-corp"
},
{
"key": "Cross-Origin-Opener-Policy",
"value": "same-origin"
}
]
}
]
} }
} }

View File

@@ -1,11 +1,44 @@
/** @type {import('next').NextConfig} */ const { PHASE_PRODUCTION_BUILD } = require("next/constants");
const nextConfig = {
output: "export", const nextConfig = (phase) =>
trailingSlash: false, /** @type {import('next').NextConfig} */ ({
reactStrictMode: true, output: phase === PHASE_PRODUCTION_BUILD ? "export" : undefined,
images: { trailingSlash: false,
unoptimized: true, reactStrictMode: true,
}, images: {
}; unoptimized: true,
},
headers:
phase === PHASE_PRODUCTION_BUILD
? undefined
: () => [
{
source: "/",
headers: [
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
],
},
{
source: "/engines/stockfish-wasm/stockfish-nnue-16.js",
headers: [
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
],
},
],
});
module.exports = nextConfig; module.exports = nextConfig;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -6,7 +6,7 @@ export class Stockfish16 extends UciEngine {
const isWasmSupported = Stockfish16.isWasmSupported(); const isWasmSupported = Stockfish16.isWasmSupported();
const enginePath = isWasmSupported const enginePath = isWasmSupported
? "engines/stockfish-wasm/stockfish-nnue-16-single.js" ? "engines/stockfish-wasm/stockfish-nnue-16.js"
: "engines/stockfish.js"; : "engines/stockfish.js";
super(EngineName.Stockfish16, enginePath); super(EngineName.Stockfish16, enginePath);

View File

@@ -39,7 +39,7 @@ export default function EvaluationBar({ height }: Props) {
alignItems="center" alignItems="center"
width="2rem" width="2rem"
height={height} height={height}
border={`1px solid black`} border="1px solid black"
borderRadius="5px" borderRadius="5px"
> >
<Box <Box

View File

@@ -23,7 +23,7 @@ export default function Accuracies() {
lineHeight={1} lineHeight={1}
padding={1} padding={1}
fontWeight="bold" fontWeight="bold"
border={`1px solid #424242`} border="1px solid #424242"
> >
{`${gameEval?.accuracy.white.toFixed(1)} %`} {`${gameEval?.accuracy.white.toFixed(1)} %`}
</Typography> </Typography>
@@ -37,7 +37,7 @@ export default function Accuracies() {
lineHeight={1} lineHeight={1}
padding={1} padding={1}
fontWeight="bold" fontWeight="bold"
border={`1px solid #424242`} border="1px solid #424242"
> >
{`${gameEval?.accuracy.black.toFixed(1)} %`} {`${gameEval?.accuracy.black.toFixed(1)} %`}
</Typography> </Typography>