bug fixes and first try of github docker
This commit is contained in:
@@ -8,6 +8,7 @@ export interface Translations {
|
||||
confirm: string;
|
||||
loading: string;
|
||||
error: string;
|
||||
save: string;
|
||||
};
|
||||
|
||||
// Header
|
||||
@@ -104,6 +105,7 @@ const en: Translations = {
|
||||
confirm: 'Confirm',
|
||||
loading: 'Loading...',
|
||||
error: 'Error',
|
||||
save: 'Save',
|
||||
},
|
||||
header: {
|
||||
tagline: 'with Gemini & Stockfish',
|
||||
@@ -186,6 +188,7 @@ const de: Translations = {
|
||||
confirm: 'Bestätigen',
|
||||
loading: 'Lädt...',
|
||||
error: 'Fehler',
|
||||
save: 'Speichern',
|
||||
},
|
||||
header: {
|
||||
tagline: 'mit Gemini & Stockfish',
|
||||
@@ -268,6 +271,7 @@ const fr: Translations = {
|
||||
confirm: 'Confirmer',
|
||||
loading: 'Chargement...',
|
||||
error: 'Erreur',
|
||||
save: 'Enregistrer',
|
||||
},
|
||||
header: {
|
||||
tagline: 'avec Gemini & Stockfish',
|
||||
@@ -350,6 +354,7 @@ const it: Translations = {
|
||||
confirm: 'Conferma',
|
||||
loading: 'Caricamento...',
|
||||
error: 'Errore',
|
||||
save: 'Salva',
|
||||
},
|
||||
header: {
|
||||
tagline: 'con Gemini & Stockfish',
|
||||
|
||||
+10
-1
@@ -27,7 +27,7 @@ export class Stockfish {
|
||||
}
|
||||
|
||||
async evaluate(fen: string, depth: number = 15, multiPV: number = 1): Promise<StockfishEvaluation> {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<StockfishEvaluation>((resolve, reject) => {
|
||||
if (!this.worker) {
|
||||
reject("Stockfish worker not initialized");
|
||||
return;
|
||||
@@ -81,6 +81,15 @@ export class Stockfish {
|
||||
this.worker.addEventListener("message", handler);
|
||||
this.worker.postMessage(`position fen ${fen}`);
|
||||
this.worker.postMessage(`go depth ${depth}`);
|
||||
}).then((evalResult: StockfishEvaluation) => {
|
||||
// Normalize score to be from White's perspective
|
||||
// Stockfish returns score relative to side to move
|
||||
const sideToMove = fen.split(" ")[1]; // 'w' or 'b'
|
||||
if (sideToMove === 'b') {
|
||||
if (evalResult.score !== 0) evalResult.score = -evalResult.score;
|
||||
if (evalResult.mate !== null && evalResult.mate !== 0) evalResult.mate = -evalResult.mate;
|
||||
}
|
||||
return evalResult;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user