From 4ced765ee643a7bd6ecadfb21a8ce3b78f0b790c Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 11 Jul 2023 12:03:21 +0200 Subject: [PATCH] Chess: Fix Black allowed to move first --- src/chess.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/chess.lua b/src/chess.lua index ba0a207..c17e76a 100644 --- a/src/chess.lua +++ b/src/chess.lua @@ -863,6 +863,11 @@ function realchess.move(pos, from_list, from_index, to_list, to_index, _, player return 0 end + if lastMove == "" then + -- Nobody has moved yet, and Black cannot move first + return 0 + end + playerBlack = playerName thisMove = "black" end