local ReplicatedStorage = game:GetService("ReplicatedStorage") local PlayMove = ReplicatedStorage:WaitForChild("ChessRemotes"):WaitForChild("Action") local Engine = require(ReplicatedStorage.Chess.Engine) local Bot = require(ReplicatedStorage.Chess.Bot) local Current = filtergc("function", { Name = "current" }) assert(Current[1](), "no active game") local State = Current[1]().state local WKing, BKing = 5, 61 for I = 1, 64 do if State.board[I] == 6 then WKing = I elseif State.board[I] == -6 then BKing = I end end local Game = { board = table.clone(State.board), turn = State.turn, castle = table.clone(State.castle), ep = State.ep, half = State.half, full = State.full, kings = { [1] = WKing, [-1] = BKing, }, } local _, BestMove = Bot.analyze(Game, 5, 4) if BestMove then PlayMove:FireServer("move", { from = BestMove.from, to = BestMove.to, promo = BestMove.promo or 0, }) end