From d5bfe6f5b2eff3c015ef42620935f7ef273fd7b8 Mon Sep 17 00:00:00 2001 From: Cozma Rares Date: Sat, 15 Apr 2023 00:40:07 +0300 Subject: [PATCH] fix: getFEN --- server/src/chess/engine.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/chess/engine.ts b/server/src/chess/engine.ts index 1ad9199..24fc5b6 100644 --- a/server/src/chess/engine.ts +++ b/server/src/chess/engine.ts @@ -416,6 +416,8 @@ export default class Chess { emptySquares = 0; } + if (emptySquares) position += `${emptySquares}`; + let castling = ""; if (this._castling.w & MOVE_FLAGS.K_CASTLE) castling += "K"; @@ -423,6 +425,8 @@ export default class Chess { if (this._castling.b & MOVE_FLAGS.K_CASTLE) castling += "k"; if (this._castling.b & MOVE_FLAGS.Q_CASTLE) castling += "q"; + if (castling == "") castling = "-"; + return [ position.substring(1), // remove first '/' this._turn,