local v_u_103 = game:GetService("Players") local v104 = game:GetService("ReplicatedStorage") local v_u_105 = game:GetService("HttpService") local v_u_106 = game:GetService("UserInputService") local v107 = v104:FindFirstChild("ChessClient") local v108 = v104:FindFirstChild("Chess") if game.PlaceId == 130878180532794 and (v108 and v107) then local v_u_109 = require(v108:WaitForChild("Engine")) local v_u_110 = require(v108:WaitForChild("Bot")) local v_u_111 = require(v107:WaitForChild("App")) local v_u_112 = { 100, 320, 335, 500, 950, 20000 } local v_u_113 = v_u_109.moveFrom local v_u_114 = v_u_109.moveTo local v_u_115 = v_u_109.movePromo local v_u_116 = v_u_109.moveFlag local v_u_117 = math.abs local v_u_118 = math.max local v_u_119 = math.min local v_u_120 = os.clock local function v_u_237(p_u_121, p_u_122) -- upvalues: (copy) v_u_120, (copy) v_u_114, (copy) v_u_116, (copy) v_u_109, (copy) v_u_115, (copy) v_u_117, (copy) v_u_113, (copy) v_u_112, (copy) v_u_110, (copy) v_u_118, (copy) v_u_119 -- prototype P033 local v123 = v_u_120() local v_u_124 = v123 + p_u_122.seconds local v_u_125 = v123 local v_u_126 = 0 local v_u_127 = false local v_u_128 = {} local v_u_129 = {} local v_u_130 = {} local v_u_131 = {} local v_u_132 = {} local function v_u_134() -- upvalues: (ref) v_u_126, (ref) v_u_127, (ref) v_u_120, (ref) v_u_125, (copy) p_u_122, (copy) v_u_124 -- prototype P024 v_u_126 = v_u_126 + 1 if v_u_126 % 32 ~= 0 then return not v_u_127 end local v133 = v_u_120() if v133 - v_u_125 >= p_u_122.slice and v133 < v_u_124 then task.wait() v133 = v_u_120() v_u_125 = v133 end v_u_127 = v_u_124 <= v133 and true or p_u_122.cancelled() return not v_u_127 end local function v_u_135() -- upvalues: (copy) p_u_121 -- prototype P025 return p_u_121.halfmove >= 100 and true or (p_u_121:repetitionCount() >= 3 and true or p_u_121:insufficientMaterial()) end local function v_u_138(p136) -- upvalues: (copy) p_u_121, (ref) v_u_114, (ref) v_u_116, (ref) v_u_109, (ref) v_u_115 -- prototype P026 local v137 if p_u_121.board[v_u_114(p136)] == 0 and v_u_116(p136) ~= v_u_109.F_EP then v137 = v_u_115(p136) == 0 else v137 = false end return v137 end local function v_u_148(p139, p140, p141) -- upvalues: (copy) p_u_121, (ref) v_u_114, (ref) v_u_117, (ref) v_u_116, (ref) v_u_109, (ref) v_u_115, (ref) v_u_113, (ref) v_u_112, (copy) v_u_130, (copy) v_u_131, (copy) v_u_129 -- prototype P027 local v142 = table.create(#p139) for v143, v144 in ipairs(p139) do local v145 = v_u_117(p_u_121.board[v_u_114(v144)]) if v_u_116(v144) == v_u_109.F_EP then v145 = v_u_109.PAWN end local v146 = v_u_115(v144) if v144 == p140 then v142[v143] = 1000000 elseif v145 == 0 and v146 == 0 then if v144 == v_u_130[p141] then v142[v143] = 10000 elseif v144 == v_u_131[p141] then v142[v143] = 9000 else v142[v143] = v_u_129[v144 * p_u_121.side] or 0 end else local v147 = v_u_117(p_u_121.board[v_u_113(v144)]) v142[v143] = 12000 + (v_u_112[v145] or 0) * 16 - (v_u_112[v147] or 0) + (v_u_112[v146] or 0) end end return v142 end local function v_u_158(p149, p150, p151) -- prototype P028 local v152 = p151 for v153 = p151 + 1, #p149 do if p150[v153] > p150[p151] then p151 = v153 end end local v154 = p149[v152] local v155 = p149[p151] p149[p151] = v154 p149[v152] = v155 local v156 = p150[v152] local v157 = p150[p151] p150[p151] = v156 p150[v152] = v157 return p149[v152] end local function v_u_178(p159, p160, p161, p162) -- upvalues: (copy) v_u_134, (copy) p_u_121, (copy) v_u_132, (copy) v_u_135, (ref) v_u_110, (ref) v_u_118, (copy) v_u_138, (copy) v_u_148, (copy) v_u_158, (ref) v_u_178, (ref) v_u_127 -- prototype P029 if not v_u_134() then return 0 end local v163 = p_u_121:inCheck() local v164 if v163 then v164 = p_u_121:legalMoves() if #v164 == 0 then return -30000 + p161 end else v164 = v_u_132[p161] if v164 then table.clear(v164) else v164 = {} v_u_132[p161] = v164 end local v165 = p_u_121:genPseudo(v164, false) local v166 = p_u_121.side local v167 = false for v168 = 1, v165 do p_u_121:makeMove(v164[v168]) v167 = not p_u_121:isAttacked(p_u_121.kingSq[v166], -v166) p_u_121:undoMove() if v167 then break end end if not v167 then return 0 end end if v_u_135() then return 0 end if p161 >= 80 then return v_u_110.evaluate(p_u_121) end if not v163 then local v169 = v_u_110.evaluate(p_u_121) if p160 <= v169 then return v169 end p159 = v_u_118(p159, v169) if p162 <= 0 then return p159 end local v170 = 0 for _, v171 in ipairs(v164) do if not v_u_138(v171) then v170 = v170 + 1 v164[v170] = v171 end end for v172 = #v164, v170 + 1, -1 do v164[v172] = nil end end local v173 = v_u_148(v164, nil, p161) for v174 = 1, #v164 do local v175 = v_u_158(v164, v173, v174) local v176 = p_u_121.side p_u_121:makeMove(v175) local v177 if v163 or not p_u_121:isAttacked(p_u_121.kingSq[v176], -v176) then v177 = -v_u_178(-p160, -p159, p161 + 1, p162 - 1) else v177 = nil end p_u_121:undoMove() if v_u_127 then return 0 end if v177 then if p160 <= v177 then return v177 end p159 = v_u_118(p159, v177) end end return p159 end local function v_u_207(p179, p180, p181, p182) -- upvalues: (ref) v_u_178, (copy) v_u_134, (copy) p_u_121, (copy) v_u_128, (copy) v_u_148, (copy) v_u_158, (copy) v_u_138, (ref) v_u_207, (copy) v_u_130, (ref) v_u_127, (ref) v_u_118, (copy) v_u_131, (copy) v_u_129, (ref) v_u_119 -- prototype P030 if p179 <= 0 then return v_u_178(p180, p181, p182, 10) end if not v_u_134() then return 0 end local v183 = p_u_121.h1 local v184 = p_u_121.h2 local v185 = p_u_121.halfmove local v186 = bit32.band(v183, 65535) local v187 = v_u_128[v186] local v188 = p_u_121:repetitionCount() if v187 and (v187.h1 ~= v183 or (v187.h2 ~= v184 or (v187.half ~= v185 or v188 > 1))) then v187 = nil end if v187 and p179 <= v187.depth then local v189 = v187.score if v189 > 29000 then v189 = v189 - p182 elseif v189 < -29000 then v189 = v189 + p182 end if v187.bound == 0 or v187.bound == 1 and p181 <= v189 or v187.bound == -1 and v189 <= p180 then return v189 end end local v190 = p_u_121:inCheck() local v191 = p_u_121:legalMoves() if #v191 == 0 then return v190 and -30000 + p182 or 0 end if v185 >= 100 or (v188 >= 3 or p_u_121:insufficientMaterial()) then return 0 end local v192 = v_u_148 local v193 if v187 then v193 = v187.best else v193 = v187 end local v194 = v192(v191, v193, p182) local v195 = v191[1] local v196 = p180 local v197 = -32000 for v198 = 1, #v191 do local v199 = v_u_158(v191, v194, v198) local v200 = v_u_138(v199) p_u_121:makeMove(v199) local v201 = nil if v198 == 1 then v201 = -v_u_207(p179 - 1, -p181, -v196, p182 + 1) else local v202 = p179 >= 3 and v198 >= 5 and (v200 and not (v190 or p_u_121:inCheck())) if v202 then if v199 == v_u_130[p182] then v202 = false else v202 = p181 == v196 + 1 end end if v202 then v201 = -v_u_207(p179 - 2, -v196 - 1, -v196, p182 + 1) end if not v_u_127 and (v201 == nil or v196 < v201) then v201 = -v_u_207(p179 - 1, -v196 - 1, -v196, p182 + 1) if not v_u_127 and (v196 < v201 and v201 < p181) then v201 = -v_u_207(p179 - 1, -p181, -v196, p182 + 1) end end end p_u_121:undoMove() if v_u_127 then return 0 end if v197 < v201 then v195 = v199 v197 = v201 end v196 = v_u_118(v196, v201) if p181 <= v196 then if v200 then if v_u_130[p182] ~= v199 then local v203 = v_u_130 v_u_131[p182] = v_u_130[p182] v203[p182] = v199 end local v204 = v199 * p_u_121.side v_u_129[v204] = v_u_119(8000, (v_u_129[v204] or 0) + p179 * p179) end break end end if v188 < 2 and (not v187 or v187.depth <= p179) then local v205 if v197 > 29000 then v205 = v197 + p182 elseif v197 < -29000 then v205 = v197 - p182 else v205 = v197 end local v206 = v_u_128[v186] or {} v206.h1 = v183 v206.h2 = v184 v206.half = v185 v206.depth = p179 v206.best = v195 v206.score = v205 v206.bound = v197 <= p180 and -1 or (p181 <= v197 and 1 or 0) v_u_128[v186] = v206 end return v197 end local function v213(p208, p209) -- upvalues: (copy) p_u_121, (copy) v_u_128 -- prototype P031 local v210 = {} for _ = 1, p209 do if not (p208 and table.find(p_u_121:legalMoves(), p208)) then break end v210[#v210 + 1] = p_u_121:moveToUci(p208) p_u_121:makeMove(p208) local v211 = v_u_128 local v212 = p_u_121.h1 p208 = v211[bit32.band(v212, 65535)] if p208 then if p208.h1 == p_u_121.h1 and (p208.h2 == p_u_121.h2 and p208.half == p_u_121.halfmove) then p208 = p208.best else p208 = false end end end for _ = 1, #v210 do p_u_121:undoMove() end return v210 end local v214 = p_u_121:legalMoves() if #v214 == 0 then return { ["terminal"] = 0, ["nodes"] = 0, ["depth"] = 0, ["elapsed"] = 0, ["lines"] = 0, ["terminal"] = p_u_121:inCheck() and "Checkmate" or "Stalemate", ["lines"] = {} } end if v_u_135() then return { ["terminal"] = "Draw", ["nodes"] = 0, ["depth"] = 0, ["elapsed"] = 0, ["lines"] = 0, ["lines"] = {} } end local v215 = p_u_121.side local v216 = v_u_119(p_u_122.lines, #v214) local v217 = v214[1] local v218 = v_u_207 local v219 = v_u_127 local v220 = v_u_126 local v221 = -32000 for _, v222 in ipairs(v214) do p_u_121:makeMove(v222) local v223 = -v_u_110.evaluate(p_u_121) p_u_121:undoMove() if v221 < v223 then v217 = v222 v221 = v223 end end local v224 = { ["best"] = 0, ["score"] = 0, ["depth"] = 0, ["nodes"] = 0, ["elapsed"] = 0, ["lines"] = 0, ["best"] = p_u_121:moveToUci(v217), ["score"] = v221 * v215, ["lines"] = {} } for v225 = 1, p_u_122.depth do if v_u_124 <= v_u_120() or p_u_122.cancelled() then break end local v226 = v_u_148(v214, v217, 0) local v227 = {} for v228 = 1, #v214 do local v229 = v_u_158(v214, v226, v228) local v230 = v227[v216] and (v227[v216].score or -32000) or -32000 p_u_121:makeMove(v229) local v231 = -v218(v225 - 1, -32000, -v230, 1) p_u_121:undoMove() if v219 then break end if #v227 < v216 or v230 < v231 then v227[#v227 + 1] = { ["move"] = 0, ["score"] = 0, ["move"] = v229, ["score"] = v231 } table.sort(v227, function(p232, p233) -- prototype P032 return p232.score > p233.score end) if v216 < #v227 then table.remove(v227) end end end if v219 then break end local v234 = {} for _, v235 in ipairs(v227) do v234[#v234 + 1] = { ["moves"] = 0, ["score"] = 0, ["moves"] = v213(v235.move, v_u_119(v225, 12)), ["score"] = v235.score * v215 } end v217 = v227[1].move v224 = { ["best"] = 0, ["score"] = 0, ["depth"] = 0, ["nodes"] = 0, ["elapsed"] = 0, ["lines"] = 0, ["best"] = p_u_121:moveToUci(v217), ["score"] = v227[1].score * v215, ["depth"] = v225, ["nodes"] = v220, ["elapsed"] = v_u_120() - v123, ["lines"] = v234 } if p_u_122.progress then p_u_122.progress(v224) end if v_u_117(v227[1].score) > 29000 then break end end if p_u_122.cancelled() then return nil end local v236 = v_u_120() - v123 v224.nodes = v220 v224.elapsed = v236 return v224 end local function v_u_246(p238, p239) -- upvalues: (copy) v_u_109 -- prototype P034 local v240 = v_u_109.new(p238) for v241, v242 in ipairs(p239 or {}) do local v243 = v240:moveFromUci(v242) local v244 if v243 then v244 = v243 ~= 0 else v244 = v243 end local v245 = "Invalid recorded move at ply " .. v241 assert(v244, v245) v240:makeMove(v243) end return v240 end local function v_u_267(p247, p248, p249) -- upvalues: (copy) v_u_237, (copy) v_u_246, (copy) v_u_117 -- prototype P036 local v250 = p249 or {} local v251 = v250.strength or 100 local v252 = math.clamp(v251, 25, 100) local v253 = v_u_237 local v254 = v250.position or v_u_246(p247, p248) local v255 = { ["seconds"] = 0, ["depth"] = 0, ["lines"] = 0, ["slice"] = 0, ["cancelled"] = 0, ["progress"] = 0 } local v256 = v250.seconds or 3 v255.seconds = math.clamp(v256, 0.05, 45) local v257 = v250.depth or 18 local v258 = math.floor(v257) v255.depth = math.clamp(v258, 1, 32) local v259 = v250.lines or 1 local v260 = math.floor(v259) local v261 = v252 < 100 and 3 or 1 v255.lines = math.clamp(v260, v261, 3) local v262 = v250.slice or 0.007 v255.slice = math.clamp(v262, 0.002, 0.014) v255.cancelled = v250.cancelled or function() -- prototype P035 return false end v255.progress = v250.progress local v263 = v253(v254, v255) if v263 and (v252 < 100 and v_u_117(v263.score or 0) < 29000) then local v264 = (100 - v252) * 3 local v265 = {} for _, v266 in ipairs(v263.lines) do if v_u_117(v266.score - v263.score) <= v264 then v265[#v265 + 1] = v266 end end if #v265 > 1 and math.random() < (100 - v252) / 75 then v263.best = v265[math.random(#v265)].moves[1] end end return v263 end if ... == "engine-only" then return v_u_267 else local v268 = getgenv local v_u_269 = type(v268) == "function" and getgenv() or _G local v270 = v_u_269.NoicRoChessStandalone local v_u_271 = { ["Preset"] = "Max", ["Depth"] = 32, ["ThinkTime"] = 12, ["Strength"] = 100, ["Lines"] = 1, ["AutoPlay"] = false, ["Hints"] = true, ["AutoRematch"] = false, ["SearchDelay"] = 3, ["MinDelay"] = 0, ["MaxDelay"] = 0, ["ClockAware"] = true, ["OpponentAnalysis"] = false, ["EngineAlerts"] = false, ["AlertMinMoves"] = 10, ["AlertMatchRate"] = 90, ["PuzzleAutoSolve"] = false } if v270 then local v272 = v270.Settings if type(v272) == "table" then for v273, v274 in pairs(v_u_271) do local v275 = v270.Settings[v273] if type(v275) == type(v274) then v_u_271[v273] = v270.Settings[v273] end end end end if v270 then local v276 = v270.Unload if type(v276) == "function" then pcall(v270.Unload) end end local v_u_277 = { ["Running"] = true, ["Settings"] = 0, ["Connections"] = 0, ["Generation"] = 0, ["Analyse"] = 0, ["Settings"] = v_u_271, ["Connections"] = {}, ["Analyse"] = v_u_267 } v_u_269.NoicRoChessStandalone = v_u_277 local v_u_278 = Color3.fromRGB(159, 219, 102) local v_u_279 = Color3.fromRGB(255, 156, 77) local v_u_280 = { ["q"] = 5, ["r"] = 4, ["b"] = 3, ["n"] = 2 } local v_u_281 = {} local v_u_282 = {} local v_u_283 = nil local v_u_284 = nil local v_u_285 = nil local v_u_286 = nil local v_u_287 = nil local v_u_288 = nil local v_u_289 = nil local v_u_290 = nil local v_u_291 = nil local v_u_292 = false local function v_u_294(p293) -- upvalues: (copy) v_u_277, (ref) v_u_284 -- prototype P037 if v_u_277.Status ~= p293 then v_u_277.Status = p293 if v_u_284 then v_u_284:Set(p293) end end end local function v_u_297() -- upvalues: (copy) v_u_277 -- prototype P039 local v_u_295 = v_u_277.OpponentMarkedBoard local v296 = v_u_277 v_u_277.OpponentMarkedBoard = nil v296.OpponentMarkedMove = nil if v_u_295 then pcall(function() -- upvalues: (copy) v_u_295 -- prototype P038 v_u_295:setArrow("noic-opponent-hint", nil) end) end end local function v_u_301(p298) -- upvalues: (copy) v_u_277, (copy) v_u_297 -- prototype P041 if v_u_277.MarkedBoard then local v_u_299 = v_u_277.MarkedBoard local v300 = v_u_277 v_u_277.MarkedBoard = nil v300.MarkedMove = nil pcall(function() -- upvalues: (copy) v_u_299 -- prototype P040 v_u_299:setArrow("noic-local-hint", nil) v_u_299:setTint("noic-local-hint", nil) end) end if not p298 then v_u_297() end end local function v_u_307() -- upvalues: (copy) v_u_277, (ref) v_u_287, (copy) v_u_271, (ref) v_u_288, (copy) v_u_301 -- prototype P042 local v302 = v_u_277 v302.Generation = v302.Generation + 1 local v303 = v_u_277 local v304 = v_u_277 v_u_277.Result = nil v303.ResultFen = nil v304.AttemptedFen = nil local v305 = v_u_277 local v306 = v_u_277 v_u_277.OpponentResult = nil v305.OpponentFen = nil v306.OpponentAttemptedFen = nil v_u_277.OpponentSample = nil v_u_277.LastReviewedReply = nil v_u_277.PuzzleAttemptedFen = nil if v_u_287 then v_u_287:Set(v_u_271.OpponentAnalysis and "Waiting for opponent" or "Off") end if v_u_288 then v_u_288:Set("") end v_u_301() end local function v_u_313(p308) -- upvalues: (copy) v_u_111, (copy) v_u_277, (copy) v_u_301, (copy) v_u_109, (copy) v_u_278 -- prototype P044 local v_u_309 = v_u_111.board if v_u_309 and p308 then if v_u_277.MarkedBoard and v_u_277.MarkedBoard ~= v_u_309 then v_u_301() end if v_u_277.MarkedBoard == v_u_309 and (v_u_277.MarkedMove == p308 and (v_u_309.arrows and v_u_309.arrows["noic-local-hint"])) then return else local v_u_310 = v_u_109.algToIndex64(p308:sub(1, 2)) local v_u_311 = v_u_109.algToIndex64(p308:sub(3, 4)) if v_u_310 ~= nil and v_u_311 ~= nil then if pcall(function() -- upvalues: (copy) v_u_309, (copy) v_u_310, (ref) v_u_278, (copy) v_u_311 -- prototype P043 v_u_309:setTint("noic-local-hint", v_u_310, v_u_278, 0.34) v_u_309:setArrow("noic-local-hint", v_u_310, v_u_311, v_u_278, 0.15) end) then local v312 = v_u_277 v_u_277.MarkedBoard = v_u_309 v312.MarkedMove = p308 end end end else return end end local function v_u_319(p314) -- upvalues: (copy) v_u_271, (copy) v_u_111, (copy) v_u_277, (copy) v_u_297, (copy) v_u_109, (copy) v_u_279 -- prototype P046 if v_u_271.OpponentAnalysis and (p314 and v_u_111.board) then local v_u_315 = v_u_111.board if v_u_277.OpponentMarkedBoard ~= v_u_315 then v_u_297() end if v_u_277.OpponentMarkedMove == p314 and (v_u_315.arrows and v_u_315.arrows["noic-opponent-hint"]) then return else local v_u_316 = v_u_109.algToIndex64(p314:sub(1, 2)) local v_u_317 = v_u_109.algToIndex64(p314:sub(3, 4)) if v_u_316 ~= nil and v_u_317 ~= nil then if pcall(function() -- upvalues: (copy) v_u_315, (copy) v_u_316, (copy) v_u_317, (ref) v_u_279 -- prototype P045 v_u_315:setArrow("noic-opponent-hint", v_u_316, v_u_317, v_u_279, 0.1) end) then local v318 = v_u_277 v_u_277.OpponentMarkedBoard = v_u_315 v318.OpponentMarkedMove = p314 end end end else return end end local function v_u_323(p320) -- upvalues: (copy) v_u_109 -- prototype P047 local v321 = p320 and ((p320.kind == "bot" or p320.kind == "online") and ((p320.myColor == v_u_109.WHITE or p320.myColor == v_u_109.BLACK) and p320.engine)) if v321 then local v322 = p320.ucis if type(v322) == "table" then v321 = p320.viewPly == #p320.ucis else v321 = false end end return v321 end local function v_u_326(p324) -- upvalues: (copy) v_u_323 -- prototype P048 local v325 = v_u_323(p324) and not p324.over if v325 then v325 = p324:isMyTurn() end return v325 end local function v_u_330(p327) -- upvalues: (copy) v_u_117 -- prototype P049 if v_u_117(p327) <= 29000 then return string.format("%+.2f", p327 / 100) end local v328 = p327 > 0 and "White" or "Black" local v329 = (30000 - v_u_117(p327)) / 2 return v328 .. " mate " .. math.ceil(v329) end local function v_u_350(p331, p332) -- upvalues: (copy) v_u_271, (copy) v_u_277, (copy) v_u_118, (ref) v_u_289, (copy) v_u_109, (ref) v_u_283 -- prototype P051 if not v_u_271.EngineAlerts then return end local v333 = v_u_277.OpponentSample if not v333 or (v333.Session ~= p331 or (v333.Ply ~= p332 - 1 or (v333.Fullmove <= 6 or (v333.LegalCount <= 1 or v333.Search.depth < 4)))) then return end local v_u_334 = v_u_277.OpponentStats if not v_u_334 or v_u_334.Session ~= p331 then v_u_334 = { ["Session"] = 0, ["Samples"] = 0, ["Seen"] = 0, ["Notified"] = false, ["Session"] = p331, ["Samples"] = {}, ["Seen"] = {} } v_u_277.OpponentStats = v_u_334 end if v_u_334.Seen[p332] then return end v_u_334.Seen[p332] = true local v335 = p331.ucis[p332] local v336 = v333.Search local v337 = v335 == v336.best if not v337 then for _, v338 in ipairs(v336.lines) do if v338.moves[1] == v335 then v337 = v_u_118(0, (v336.score - v338.score) * v333.Side) <= 30 break end end end v_u_334.Samples[#v_u_334.Samples + 1] = v337 if #v_u_334.Samples > v_u_118(12, v_u_271.AlertMinMoves) then table.remove(v_u_334.Samples, 1) end local v_u_339 = 0 for _, v340 in ipairs(v_u_334.Samples) do if v340 then v_u_339 = v_u_339 + 1 end end v_u_334.Matches = v_u_339 v_u_334.Rate = v_u_339 / #v_u_334.Samples * 100 if v_u_289 then local v341 = v_u_289 local v342 = string.format local v343 = #v_u_334.Samples local v344 = v_u_334.Rate + 0.5 v341:Set(v342("Engine matches %d/%d (%d%%)", v_u_339, v343, math.floor(v344))) end if not v_u_334.Notified and (#v_u_334.Samples >= v_u_271.AlertMinMoves and v_u_334.Rate >= v_u_271.AlertMatchRate) then local v345 = p331[p331.myColor == v_u_109.WHITE and "black" or "white"] local v_u_346 = type(v345) ~= "table" or v345.display or (v345.name or "Opponent") if pcall(function() -- upvalues: (ref) v_u_283, (copy) v_u_346, (ref) v_u_339, (ref) v_u_334 -- prototype P050 local v347 = v_u_283 local v348 = { ["title"] = "Engine-like play", ["content"] = 0, ["duration"] = 8 } local v349 = v_u_346 v348.content = string.format("%s matched %d/%d analysed moves within 0.30 pawns. This pattern alone cannot establish cheating.", tostring(v349), v_u_339, #v_u_334.Samples) v347:Notify(v348) end) then v_u_334.Notified = true end end end local function v_u_357(p351) -- upvalues: (copy) v_u_277, (ref) v_u_285, (copy) v_u_118, (copy) v_u_282, (copy) v_u_330, (copy) v_u_119 -- prototype P052 v_u_277.Result = p351 if v_u_285 then local v352 = p351.nodes / v_u_118(p351.elapsed, 0.001) local v353 = math.floor(v352) v_u_285:Set(string.format("Depth %d | %d nodes | %d n/s", p351.depth, p351.nodes, v353)) for v354, v355 in ipairs(v_u_282) do local v356 = p351.lines[v354] v355:Set(not v356 and "" or v_u_330(v356.score) .. " " .. table.concat(v356.moves, " ", 1, v_u_119(5, #v356.moves))) end end end local function v_u_361(p358) -- upvalues: (copy) v_u_118 -- prototype P053 local v359 = p358.clocks if v359 then v359 = p358.clocks[p358.myColor] end if type(v359) ~= "number" then return math.huge end local v360 = p358.turnStart if type(v360) == "number" then v359 = v359 - (workspace:GetServerTimeNow() - p358.turnStart) * 1000 end return v_u_118(0, v359 / 1000) end local function v_u_365(p362, p363, p364) -- upvalues: (copy) v_u_326, (copy) v_u_111, (copy) v_u_294, (copy) v_u_277, (copy) v_u_109, (copy) v_u_280 -- prototype P054 if v_u_326(p362) and (v_u_111.session == p362 and p362.engine:getFen() == p363) then if p362.engine:moveFromUci(p364) then v_u_277.AttemptedFen = p363 v_u_294(v_u_111.onBoardMove(v_u_109.algToIndex64(p364:sub(1, 2)), v_u_109.algToIndex64(p364:sub(3, 4)), v_u_280[p364:sub(5)] or 0, false) == true and ("Played " .. p364 or "Move rejected") or "Move rejected") else v_u_294("Move invalidated") end else return end end local function v_u_370(p366, p367) -- upvalues: (copy) v_u_246, (copy) v_u_109 -- prototype P055 local v368, v369 = pcall(v_u_246, p366.startFen or v_u_109.START_FEN, table.clone(p366.ucis)) if v368 and v369:getFen() == p367 then return v369 else return v_u_109.new(p367) end end local function v_u_375(p371) -- prototype P056 local v372 = p371 and ((p371.kind == "puzzle" or p371.kind == "rush") and p371.engine) if v372 then local v373 = p371.ucis if type(v373) == "table" then local v374 = p371.pz if type(v374) == "table" then v372 = p371.viewPly == #p371.ucis else v372 = false end else v372 = false end end return v372 end local function v_u_377(p376) -- upvalues: (ref) v_u_290 -- prototype P057 if v_u_290 then v_u_290:Set(p376) end end function v_u_277.SolvePuzzle() -- upvalues: (copy) v_u_111, (copy) v_u_375, (copy) v_u_377, (copy) v_u_277, (copy) v_u_307 -- prototype P058 local v378 = v_u_111.session if not v_u_375(v378) then v_u_377("Open a puzzle first") return false end if v378.pz.done or (v378.pz.wrong or v378.over) then v_u_377(v378.pz.done and "Solved" or "Puzzle ended") return false end v_u_277.Manual = false v_u_307() v_u_277.PuzzleRequest = v378 v_u_377("Ready to solve") return true end local function v_u_395(p_u_379, p_u_380) -- upvalues: (copy) v_u_277, (copy) v_u_111, (copy) v_u_271, (copy) v_u_377, (copy) v_u_267, (copy) v_u_370, (copy) v_u_357, (copy) v_u_313, (ref) v_u_291, (copy) v_u_109, (copy) v_u_280, (copy) v_u_301 -- prototype P062 local v_u_381 = v_u_277.Generation local v_u_382 = p_u_379.pz local function v_u_385() -- upvalues: (ref) v_u_277, (copy) v_u_381, (ref) v_u_111, (copy) p_u_379, (copy) v_u_382, (copy) p_u_380, (ref) v_u_271 -- prototype P059 local v383 = not v_u_277.Running or (v_u_277.Generation ~= v_u_381 or v_u_111.session ~= p_u_379 or (p_u_379.pz ~= v_u_382 or p_u_379.over) or (v_u_382.done or v_u_382.wrong or (v_u_382.busy or not p_u_379:isMyTurn()))) if not v383 then if p_u_379.engine:getFen() == p_u_380 then local v384 = v_u_271.PuzzleAutoSolve or v_u_277.PuzzleRequest == p_u_379 v383 = not v384 else v383 = true end end return v383 end local v386 = v_u_382.sol local v387 if type(v386) == "table" then v387 = v_u_382.sol[v_u_382.step] else v387 = false end local function v391(p388) -- upvalues: (copy) p_u_379 -- prototype P060 if type(p388) ~= "string" then return false end local v389 = p_u_379.engine:moveFromUci(p388) local v390 if v389 == nil then v390 = false else v390 = v389 ~= 0 end return v390 end if not v391(v387) then v_u_377("Searching for solution") local v393 = v_u_267(p_u_380, nil, { ["position"] = 0, ["seconds"] = 0, ["depth"] = 0, ["strength"] = 100, ["lines"] = 1, ["cancelled"] = 0, ["progress"] = 0, ["position"] = v_u_370(p_u_379, p_u_380), ["seconds"] = v_u_271.ThinkTime, ["depth"] = v_u_271.Depth, ["cancelled"] = v_u_385, ["progress"] = function(p392) -- upvalues: (copy) v_u_385, (ref) v_u_357, (ref) v_u_377, (ref) v_u_271, (ref) v_u_313 -- prototype P061 if not v_u_385() then v_u_357(p392) v_u_377("Searching depth " .. p392.depth) if v_u_271.Hints then v_u_313(p392.best) end end end }) if not v393 or v_u_385() then return end v_u_357(v393) v387 = v393.best end if v_u_385() then return else v_u_277.PuzzleAttemptedFen = p_u_380 if v391(v387) then v_u_291:Set(v387) v_u_377("Playing " .. v387) local v394 = v_u_111.onBoardMove(v_u_109.algToIndex64(v387:sub(1, 2)), v_u_109.algToIndex64(v387:sub(3, 4)), v_u_280[v387:sub(5)] or 0, false) v_u_301() v_u_377(v394 == true and "Waiting for puzzle response" or "Move rejected") else v_u_377("No legal solution found") end end end local function v_u_400(p396, p397, p398) -- upvalues: (copy) v_u_277, (ref) v_u_287, (ref) v_u_288, (copy) v_u_330, (copy) v_u_119, (copy) v_u_319 -- prototype P063 if p396.best then v_u_277.OpponentResult = { ["Search"] = 0, ["Fen"] = 0, ["Ply"] = 0, ["Search"] = p396, ["Fen"] = p397, ["Ply"] = p398 } v_u_287:Set(string.format("Best reply %s | Depth %d", p396.best, p396.depth)) local v399 = p396.lines[1] and p396.lines[1].moves or { p396.best } v_u_288:Set(v_u_330(p396.score) .. " " .. table.concat(v399, " ", 1, v_u_119(5, #v399))) v_u_319(p396.best) end end local function v_u_404(p401, p402) -- upvalues: (copy) v_u_271, (ref) v_u_287, (ref) v_u_288, (copy) v_u_330, (copy) v_u_119, (copy) v_u_277 -- prototype P064 if v_u_271.OpponentAnalysis then for _, v403 in ipairs(p401.lines) do if v403.moves[1] == p401.best and v403.moves[2] then v_u_287:Set("After " .. p401.best .. ", expect " .. v403.moves[2]) v_u_288:Set(v_u_330(v403.score) .. " " .. table.concat(v403.moves, " ", 2, v_u_119(5, #v403.moves))) v_u_277.OpponentResult = { ["Ply"] = 0, ["Expected"] = 0, ["After"] = 0, ["Ply"] = p402 + 1, ["Expected"] = v403.moves[2], ["After"] = p401.best } return end end end end local function v_u_417(p_u_405, p_u_406) -- upvalues: (copy) v_u_277, (copy) v_u_271, (copy) v_u_111, (copy) v_u_323, (copy) v_u_370, (ref) v_u_289, (copy) v_u_400, (copy) v_u_267, (copy) v_u_119 -- prototype P067 local v_u_407 = v_u_277.Generation local v_u_408 = #p_u_405.ucis local function v_u_409() -- upvalues: (ref) v_u_277, (copy) v_u_407, (ref) v_u_271, (ref) v_u_111, (copy) p_u_405, (ref) v_u_323, (copy) v_u_408, (copy) p_u_406 -- prototype P065 return not v_u_277.Running or (v_u_407 ~= v_u_277.Generation and true or (not (v_u_271.OpponentAnalysis or v_u_271.EngineAlerts) or (v_u_111.session ~= p_u_405 or not v_u_323(p_u_405)) or (p_u_405.over or p_u_405:isMyTurn() or (#p_u_405.ucis ~= v_u_408 and true or p_u_405.engine:getFen() ~= p_u_406)))) end local v410 = v_u_370(p_u_405, p_u_406) local v_u_411 = #v410:legalMoves() local v_u_412 = v410.fullmove local v_u_413 = v410.side if v_u_271.EngineAlerts and v_u_289 then if v_u_412 <= 6 then v_u_289:Set("Opening moves excluded") elseif v_u_411 <= 1 then v_u_289:Set("Forced move excluded") elseif not v_u_277.OpponentStats then v_u_289:Set("Waiting for a depth-4 comparison") end end local function v415(p414) -- upvalues: (copy) v_u_409, (ref) v_u_400, (copy) p_u_406, (copy) v_u_408, (ref) v_u_271, (ref) v_u_277, (copy) p_u_405, (copy) v_u_412, (copy) v_u_411, (copy) v_u_413 -- prototype P066 if not v_u_409() then v_u_400(p414, p_u_406, v_u_408) if v_u_271.EngineAlerts and p414.depth >= 4 then v_u_277.OpponentSample = { ["Session"] = 0, ["Ply"] = 0, ["Fullmove"] = 0, ["LegalCount"] = 0, ["Side"] = 0, ["Search"] = 0, ["Session"] = p_u_405, ["Ply"] = v_u_408, ["Fullmove"] = v_u_412, ["LegalCount"] = v_u_411, ["Side"] = v_u_413, ["Search"] = p414 } end end end local v416 = v_u_267(p_u_406, nil, { ["position"] = 0, ["lines"] = 0, ["seconds"] = 0, ["depth"] = 0, ["cancelled"] = 0, ["progress"] = 0, ["position"] = v410, ["lines"] = v_u_271.EngineAlerts and 3 or 1, ["seconds"] = v_u_119(v_u_271.ThinkTime, 2), ["depth"] = v_u_271.Depth, ["cancelled"] = v_u_409, ["progress"] = v415 }) if v416 and not v_u_409() then v415(v416) v_u_277.OpponentFen = p_u_406 end end local function v_u_422(p418) -- upvalues: (copy) v_u_277, (copy) v_u_350, (ref) v_u_287, (ref) v_u_288 -- prototype P068 local v419 = v_u_277.OpponentResult local v420 = #p418.ucis v_u_350(p418, v420) if v420 < 1 or v_u_277.LastReviewedReply == v420 then return else v_u_277.LastReviewedReply = v420 if v419 and (v419.Ply == v420 - 1 and (not v419.After or p418.ucis[v420 - 1] == v419.After)) then local v421 = v419.Expected or v419.Search.best v_u_287:Set("Played " .. p418.ucis[v420] .. " | Expected " .. v421) else v_u_287:Set("Played " .. p418.ucis[v420]) v_u_288:Set("") end end end local function v_u_432(p_u_423, p_u_424) -- upvalues: (copy) v_u_277, (copy) v_u_111, (copy) v_u_326, (copy) v_u_271, (copy) v_u_361, (copy) v_u_118, (copy) v_u_119, (copy) v_u_120, (copy) v_u_267, (copy) v_u_370, (copy) v_u_357, (copy) v_u_313, (copy) v_u_294, (copy) v_u_404, (copy) v_u_365 -- prototype P071 local v_u_425 = v_u_277.Generation local function v_u_426() -- upvalues: (ref) v_u_277, (copy) v_u_425, (ref) v_u_111, (copy) p_u_423, (ref) v_u_326, (copy) p_u_424 -- prototype P069 return not v_u_277.Running or (v_u_425 ~= v_u_277.Generation and true or (v_u_111.session ~= p_u_423 or not v_u_326(p_u_423) or p_u_423.engine:getFen() ~= p_u_424)) end local v427 = v_u_271.ThinkTime if v_u_271.ClockAware then v427 = v_u_119(v427, v_u_118(0.05, v_u_361(p_u_423) / 18)) end local v428 = v_u_120() local v429 = v_u_271.MinDelay + math.random() * v_u_118(0, v_u_271.MaxDelay - v_u_271.MinDelay) if v_u_271.ClockAware then v429 = v_u_119(v429, v_u_361(p_u_423) * 0.12) end local v431 = v_u_267(p_u_424, nil, { ["position"] = 0, ["seconds"] = 0, ["depth"] = 0, ["strength"] = 0, ["lines"] = 0, ["cancelled"] = 0, ["progress"] = 0, ["position"] = v_u_370(p_u_423, p_u_424), ["seconds"] = v427, ["depth"] = v_u_271.Depth, ["strength"] = v_u_271.Strength, ["lines"] = v_u_271.Lines, ["cancelled"] = v_u_426, ["progress"] = function(p430) -- upvalues: (copy) v_u_426, (ref) v_u_357, (ref) v_u_271, (ref) v_u_313 -- prototype P070 if not v_u_426() then v_u_357(p430) if v_u_271.Hints then v_u_313(p430.best) end end end }) if v431 and not v_u_426() then v_u_357(v431) v_u_277.ResultFen = p_u_424 v_u_294(v431.best or (v431.terminal or "No move")) if v_u_271.Hints and v431.best then v_u_313(v431.best) end v_u_404(v431, #p_u_423.ucis) if v_u_271.AutoPlay and v431.best then while v_u_120() - v428 < v429 and (v_u_271.AutoPlay and not v_u_426()) do task.wait(0.05) end if v_u_271.AutoPlay and not v_u_426() then v_u_365(p_u_423, p_u_424, v431.best) end end end end local function v_u_439(p_u_433, p_u_434) -- upvalues: (copy) v_u_277, (copy) v_u_294, (copy) v_u_307, (copy) v_u_267, (copy) v_u_271, (copy) v_u_357 -- prototype P075 if v_u_277.Busy then v_u_294("Stop the current search first") else v_u_307() v_u_277.Manual = true v_u_277.Busy = true local v_u_435 = v_u_277.Generation v_u_294("Analysing position") task.spawn(function() -- upvalues: (ref) v_u_267, (copy) p_u_433, (copy) p_u_434, (ref) v_u_271, (ref) v_u_277, (copy) v_u_435, (ref) v_u_357, (ref) v_u_294 -- prototype P074 local v437, v438 = pcall(v_u_267, p_u_433, p_u_434, { ["seconds"] = 0, ["depth"] = 0, ["lines"] = 0, ["cancelled"] = 0, ["progress"] = 0, ["seconds"] = v_u_271.ThinkTime, ["depth"] = v_u_271.Depth, ["lines"] = v_u_271.Lines, ["cancelled"] = function() -- upvalues: (ref) v_u_277, (ref) v_u_435 -- prototype P072 return not v_u_277.Running or v_u_277.Generation ~= v_u_435 end, ["progress"] = function(p436) -- upvalues: (ref) v_u_277, (ref) v_u_435, (ref) v_u_357 -- prototype P073 if v_u_277.Running and v_u_435 == v_u_277.Generation then v_u_357(p436) end end }) v_u_277.Busy = false if v_u_277.Running and v_u_435 == v_u_277.Generation then if v437 and v438 then v_u_357(v438) v_u_294(v438.best or (v438.terminal or "No move")) elseif not v437 then v_u_294("Position search failed") warn("[Noic RoChess] " .. tostring(v438)) end else return end end) end end local function v_u_455(p440) -- prototype P076 local v441, v442, v443, v444, v445, v446 = p440:match("^([prnbqkPRNBQK1-8/]+)%s+([wb])%s+([KQkq%-]+)%s+([a-h36%-]+)%s+(%d+)%s+(%d+)$") if not (v441 and (v442 and (v443 and (v445 and v446)))) then return false end local v447 = string.split(v441, "/") if #v447 ~= 8 or (#v446 > 8 or (#v445 > 8 or tonumber(v446) < 1)) then return false end if v443 ~= "-" and (v443 == "" or not v443:match("^K?Q?k?q?$")) then return false end if v444 ~= "-" and not v444:match(v442 == "w" and "^[a-h]6$" or "^[a-h]3$") then return false end local v448 = { ["K"] = 0, ["k"] = 0 } for v449, v450 in ipairs(v447) do local v451 = 0 for v452 = 1, #v450 do local v453 = v450:sub(v452, v452) v451 = v451 + (tonumber(v453) or 1) if v448[v453] then v448[v453] = v448[v453] + 1 end if (v449 == 1 or v449 == 8) and (v453 == "p" or v453 == "P") then return false end end if v451 ~= 8 then return false end end local v454 if v448.K == 1 then v454 = v448.k == 1 else v454 = false end return v454 end local function v_u_458(p456) -- upvalues: (copy) v_u_294 -- prototype P077 local v457 = setclipboard if type(v457) == "function" and pcall(setclipboard, p456) then v_u_294("Copied") else v_u_294("Clipboard unavailable") end end local function v_u_461(p459) -- upvalues: (copy) v_u_111, (copy) v_u_109 -- prototype P078 if v_u_111.session == p459 and (p459.over and not (v_u_111.searching or v_u_111.joining)) then if p459.kind == "online" then v_u_111.newGame() else local v460 = p459.myColor == v_u_109.BLACK and "black" or "white" v_u_111.startBotGame(p459.bot or (v_u_111.selectedBot or "jasper"), v460) end else return end end function v_u_277.Unload() -- upvalues: (copy) v_u_277, (copy) v_u_307, (ref) v_u_283, (ref) v_u_286, (copy) v_u_269 -- prototype P079 if v_u_277.Running then v_u_277.Running = false v_u_307() for _, v462 in ipairs(v_u_277.Connections) do v462:Disconnect() end if v_u_283 then pcall(v_u_283.Unload, v_u_283) end if v_u_286 then local v463 = v_u_286.Destroy if type(v463) == "function" then pcall(v_u_286.Destroy, v_u_286) end end if v_u_269.NoicRoChessStandalone == v_u_277 then v_u_269.NoicRoChessStandalone = nil end end end local v_u_464 = { ["Quick"] = 0, ["Balanced"] = 0, ["Max"] = 0, ["Quick"] = { ["Depth"] = 10, ["ThinkTime"] = 0.6, ["Strength"] = 100, ["Lines"] = 1, ["MinDelay"] = 0, ["MaxDelay"] = 0 }, ["Balanced"] = { ["Depth"] = 20, ["ThinkTime"] = 3, ["Strength"] = 85, ["Lines"] = 1, ["MinDelay"] = 0.3, ["MaxDelay"] = 1 }, ["Max"] = { ["Depth"] = 32, ["ThinkTime"] = 12, ["Strength"] = 100, ["Lines"] = 1, ["MinDelay"] = 0, ["MaxDelay"] = 0 } } local function v_u_468(p465) -- upvalues: (ref) v_u_292, (copy) v_u_271, (copy) v_u_464, (copy) v_u_281, (copy) v_u_277, (copy) v_u_307 -- prototype P080 if not v_u_292 then v_u_292 = true v_u_271.Preset = p465 for v466, v467 in pairs(v_u_464[p465] or {}) do v_u_271[v466] = v467 if v_u_281[v466] then v_u_281[v466]:Set(v467, true) end end v_u_292 = false v_u_277.Manual = false v_u_307() end end local function v_u_472(p469, p470, p471) -- upvalues: (ref) v_u_292, (copy) v_u_271, (copy) v_u_277, (copy) v_u_281, (copy) v_u_307 -- prototype P081 if not v_u_292 and v_u_271[p469] ~= p470 then v_u_271[p469] = p470 if p469 == "PuzzleAutoSolve" and not p470 then v_u_277.PuzzleRequest = nil end if p469 == "MinDelay" and v_u_271.MaxDelay < p470 then v_u_271.MaxDelay = p470 if v_u_281.MaxDelay then v_u_281.MaxDelay:Set(p470, true) end elseif p469 == "MaxDelay" and p470 < v_u_271.MinDelay then v_u_271.MinDelay = p470 if v_u_281.MinDelay then v_u_281.MinDelay:Set(p470, true) end end if p471 then v_u_271.Preset = "Custom" if v_u_281.Preset then v_u_281.Preset:Set("Custom", true) end end v_u_277.Manual = false v_u_307() end end local function v_u_484() -- upvalues: (copy) v_u_269, (copy) v_u_105, (ref) v_u_283, (copy) v_u_277 -- prototype P084 local v473 = v_u_269.__NoicRoChessHideDiscord == true local v474 = readfile if type(v474) == "function" then local v475, v476 = pcall(function() -- upvalues: (ref) v_u_105 -- prototype P082 return v_u_105:JSONDecode(readfile("NoicHub_RoChess_preferences.json")) end) if v475 and type(v476) == "table" then v473 = v476.hideDiscordPopup == true end end pcall(v_u_283.OpenDiscord, v_u_283, "https://discord.gg/MPrZfv753z", true) if v473 then return else local v_u_477 = v_u_283:ShowDiscordPrompt({ ["invite"] = "https://discord.gg/MPrZfv753z", ["title"] = "Fuck noic!", ["content"] = "Join my discord server, for more content", ["joinDelay"] = 0, ["continueDelay"] = 0 }) if v_u_477 and v_u_477._continue then local v478 = v_u_477._continue.Parent.Parent.Parent.Parent local v479 = Instance.new("TextButton") v479.Name = "DontShowAgain" v479.Size = UDim2.new(1, 0, 0, 28) v479.LayoutOrder = 5 v479.BackgroundColor3 = Color3.fromRGB(38, 38, 48) v479.BorderSizePixel = 0 v479.Text = "Don\'t show again" v479.TextColor3 = Color3.fromRGB(220, 220, 230) v479.Font = Enum.Font.GothamMedium v479.TextSize = 12 v479.Parent = v478 local v480 = v_u_277.Connections local v481 = v479.Activated local function v483() -- upvalues: (ref) v_u_269, (ref) v_u_105, (copy) v_u_477 -- prototype P083 v_u_269.__NoicRoChessHideDiscord = true local v482 = writefile if type(v482) == "function" then pcall(writefile, "NoicHub_RoChess_preferences.json", v_u_105:JSONEncode({ ["hideDiscordPopup"] = true })) end v_u_477:Close() end table.insert(v480, v481:Connect(v483)) end end end local function v530() -- upvalues: (ref) v_u_286, (ref) v_u_283, (copy) v_u_106, (copy) v_u_103, (copy) v_u_277, (copy) v_u_281, (copy) v_u_271, (copy) v_u_472, (copy) v_u_468, (ref) v_u_284, (copy) v_u_307, (copy) v_u_377, (ref) v_u_290, (ref) v_u_291, (copy) v_u_455, (copy) v_u_294, (copy) v_u_439, (copy) v_u_111, (copy) v_u_109, (copy) v_u_458, (ref) v_u_285, (copy) v_u_282, (copy) v_u_330, (ref) v_u_287, (ref) v_u_288, (ref) v_u_289 -- prototype P099 local v485 = game:HttpGet("https://raw.githubusercontent.com/ludicious-claw/ideal-happiness/refs/heads/main/OnyxUI.lua") local v486, v487 = loadstring(v485, "OnyxUI") assert(v486, v487) v_u_286 = v486() v_u_283 = v_u_286:CreateWindow({ ["name"] = "RoChess", ["subtitle"] = "Noic Hub", ["toggleKey"] = 0, ["mobile"] = 0, ["discord"] = "https://discord.gg/MPrZfv753z", ["configuration"] = 0, ["toggleKey"] = Enum.KeyCode.RightShift, ["mobile"] = v_u_106.TouchEnabled or not v_u_106.KeyboardEnabled, ["configuration"] = { ["fileName"] = "NoicRoChessLuau", ["autoSave"] = false, ["autoLoad"] = false } }) local v488 = v_u_103.LocalPlayer:WaitForChild("PlayerGui") if v_u_283._gui then v_u_283._gui.Name = "NoicRoChessStandalone" v_u_283._gui.ResetOnSpawn = false v_u_283._gui.Parent = v488 end local v_u_489 = v_u_283.Unload function v_u_283.Unload(p490) -- upvalues: (ref) v_u_277, (copy) v_u_489 -- prototype P085 if not v_u_277.Running then return v_u_489(p490) end v_u_277.Unload() end v_u_283.Destroy = v_u_283.Unload local v491 = v_u_283:CreateTab({ ["name"] = "Play" }) local v492 = v491:CreateSection({ ["name"] = "Engine", ["side"] = "left" }) local v493 = v491:CreateSection({ ["name"] = "Timing", ["side"] = "right" }) local function v498(p494, p495, p_u_496) -- upvalues: (ref) v_u_281, (ref) v_u_271, (ref) v_u_472 -- prototype P087 v_u_281[p_u_496] = p494:CreateToggle({ ["name"] = 0, ["value"] = 0, ["callback"] = 0, ["name"] = p495, ["value"] = v_u_271[p_u_496], ["callback"] = function(p497) -- upvalues: (ref) v_u_472, (copy) p_u_496 -- prototype P086 v_u_472(p_u_496, p497 == true) end }) end local function v509(p499, p500, p_u_501, p502, p503, p504, p505, p_u_506) -- upvalues: (ref) v_u_281, (ref) v_u_271, (ref) v_u_472 -- prototype P089 v_u_281[p_u_501] = p499:CreateSlider({ ["name"] = 0, ["range"] = 0, ["value"] = 0, ["increment"] = 0, ["suffix"] = 0, ["callback"] = 0, ["name"] = p500, ["range"] = { p502, p503 }, ["value"] = v_u_271[p_u_501], ["increment"] = p504, ["suffix"] = p505 or "", ["callback"] = function(p507, p508) -- upvalues: (ref) v_u_472, (copy) p_u_501, (copy) p_u_506 -- prototype P088 if not p508 then v_u_472(p_u_501, p507, p_u_506) end end }) end v_u_281.Preset = v492:CreateDropdown({ ["name"] = "Preset", ["options"] = 0, ["value"] = 0, ["callback"] = 0, ["options"] = { "Quick", "Balanced", "Max", "Custom" }, ["value"] = v_u_271.Preset, ["callback"] = v_u_468 }) v498(v492, "Auto play", "AutoPlay") v498(v492, "Board hints", "Hints") v509(v492, "Depth limit", "Depth", 1, 32, 1, "", true) v509(v492, "Strength", "Strength", 25, 100, 1, "%", true) v509(v493, "Think time", "ThinkTime", 0.1, 45, 0.1, "s", true) v498(v493, "Clock-aware search", "ClockAware") v509(v493, "Min delay", "MinDelay", 0, 30, 0.1, "s", true) v509(v493, "Max delay", "MaxDelay", 0, 30, 0.1, "s", true) v498(v493, "Auto search new game", "AutoRematch") v509(v493, "New game delay", "SearchDelay", 1, 20, 1, "s") v_u_284 = v492:CreateLabel(v_u_277.Status or "Ready") local v510 = v_u_283:CreateTab({ ["name"] = "Puzzle" }) local v511 = v510:CreateSection({ ["name"] = "Solver", ["side"] = "left" }) local v512 = v510:CreateSection({ ["name"] = "Current puzzle", ["side"] = "right" }) v498(v511, "Auto solve", "PuzzleAutoSolve") v511:CreateButton({ ["name"] = "Solve current puzzle", ["callback"] = 0, ["callback"] = v_u_277.SolvePuzzle }) v511:CreateButton({ ["name"] = "Stop solving", ["callback"] = 0, ["callback"] = function() -- upvalues: (ref) v_u_281, (ref) v_u_277, (ref) v_u_307, (ref) v_u_377 -- prototype P090 v_u_281.PuzzleAutoSolve:Set(false) v_u_277.PuzzleRequest = nil v_u_307() v_u_377("Stopped") end }) v_u_290 = v512:CreateLabel("Open a puzzle") v_u_291 = v512:CreateLabel("") local v513 = v_u_283:CreateTab({ ["name"] = "Analysis" }) local v514 = v513:CreateSection({ ["name"] = "Position", ["side"] = "left" }) local v515 = v513:CreateSection({ ["name"] = "Candidate lines", ["side"] = "right" }) local v_u_516 = "" v514:CreateInput({ ["name"] = "FEN", ["placeholder"] = "Paste a position", ["callback"] = 0, ["callback"] = function(p517) -- upvalues: (ref) v_u_516 -- prototype P091 v_u_516 = p517 end }) v514:CreateButton({ ["name"] = "Analyse FEN", ["callback"] = 0, ["callback"] = function() -- upvalues: (ref) v_u_516, (ref) v_u_455, (ref) v_u_294, (ref) v_u_439 -- prototype P092 local v518 = v_u_516:match("^%s*(.-)%s*$") if v_u_455(v518) then v_u_439(v518) else v_u_294("Enter a valid FEN") end end }) v514:CreateButton({ ["name"] = "Analyse board", ["callback"] = 0, ["callback"] = function() -- upvalues: (ref) v_u_111, (ref) v_u_439, (ref) v_u_109 -- prototype P093 local v519 = v_u_111.session if v519 and v519.engine then local v520 = v519.viewPly or #(v519.ucis or {}) local v521 = table.create(v520) for v522 = 1, v520 do v521[v522] = v519.ucis[v522] end v_u_439(v519.startFen or v_u_109.START_FEN, v521) end end }) v514:CreateButton({ ["name"] = "Stop search", ["callback"] = 0, ["callback"] = function() -- upvalues: (ref) v_u_307, (ref) v_u_277, (ref) v_u_294 -- prototype P094 v_u_307() v_u_277.Manual = true v_u_294("Stopped") end }) v514:CreateButton({ ["name"] = "Resume analysis", ["callback"] = 0, ["callback"] = function() -- upvalues: (ref) v_u_277, (ref) v_u_307 -- prototype P095 v_u_277.Manual = false v_u_307() end }) v514:CreateButton({ ["name"] = "Copy FEN", ["callback"] = 0, ["callback"] = function() -- upvalues: (ref) v_u_111, (ref) v_u_458 -- prototype P096 local v523 = v_u_111.session if v523 and v523.engine then v_u_458(v523.engine:getFen()) end end }) v509(v515, "Candidate count", "Lines", 1, 3, 1) v_u_285 = v515:CreateLabel("Search idle") for v524 = 1, 3 do v_u_282[v524] = v515:CreateLabel("") end v515:CreateButton({ ["name"] = "Copy variations", ["callback"] = 0, ["callback"] = function() -- upvalues: (ref) v_u_277, (ref) v_u_330, (ref) v_u_458 -- prototype P097 local v525 = {} for _, v526 in ipairs(v_u_277.Result and v_u_277.Result.lines or {}) do v525[#v525 + 1] = v_u_330(v526.score) .. " " .. table.concat(v526.moves, " ") end if #v525 > 0 then v_u_458(table.concat(v525, "\n")) end end }) local v527 = v513:CreateSection({ ["name"] = "Opponent", ["side"] = "right" }) v498(v527, "Opponent analysis", "OpponentAnalysis") v_u_287 = v527:CreateLabel(v_u_271.OpponentAnalysis and "Waiting for opponent" or "Off") v_u_288 = v527:CreateLabel("") local v528 = v513:CreateSection({ ["name"] = "Move-pattern alerts", ["side"] = "left" }) v498(v528, "Engine-like play alerts", "EngineAlerts") v509(v528, "Minimum analysed moves", "AlertMinMoves", 8, 30, 1) v509(v528, "Match threshold", "AlertMatchRate", 80, 100, 1, "%") v_u_289 = v528:CreateLabel("Waiting for analysed moves") local v529 = v_u_283:CreateTab({ ["name"] = "Hub" }):CreateSection("RoChess") v529:CreateLabel("Local Luau engine") v529:CreateLabel("Menu key: Right Shift") v529:CreateButton({ ["name"] = "Join Discord", ["callback"] = 0, ["callback"] = function() -- upvalues: (ref) v_u_283 -- prototype P098 v_u_283:OpenDiscord("https://discord.gg/MPrZfv753z") end }) v529:CreateButton({ ["name"] = "Unload", ["callback"] = 0, ["callback"] = v_u_277.Unload }) end local v531, v532 = pcall(v530) if v531 then task.defer(function() -- upvalues: (copy) v_u_277, (copy) v_u_484 -- prototype P100 if v_u_277.Running then pcall(v_u_484) end end) task.spawn(function() -- upvalues: (copy) v_u_277, (copy) v_u_111, (ref) v_u_289, (copy) v_u_307, (copy) v_u_323, (copy) v_u_271, (copy) v_u_120, (copy) v_u_461, (copy) v_u_375, (copy) v_u_301, (copy) v_u_377, (copy) v_u_294, (copy) v_u_395, (copy) v_u_422, (copy) v_u_297, (copy) v_u_319, (ref) v_u_287, (ref) v_u_288, (copy) v_u_417, (copy) v_u_313, (copy) v_u_432 -- prototype P102 local v_u_533 = nil local v_u_534 = nil local v_u_535 = nil while v_u_277.Running do local v547, v548 = pcall(function() -- upvalues: (ref) v_u_111, (ref) v_u_534, (ref) v_u_533, (ref) v_u_535, (ref) v_u_277, (ref) v_u_289, (ref) v_u_307, (ref) v_u_323, (ref) v_u_271, (ref) v_u_120, (ref) v_u_461, (ref) v_u_375, (ref) v_u_301, (ref) v_u_377, (ref) v_u_294, (ref) v_u_395, (ref) v_u_422, (ref) v_u_297, (ref) v_u_319, (ref) v_u_287, (ref) v_u_288, (ref) v_u_417, (ref) v_u_313, (ref) v_u_432 -- prototype P101 local v536 = v_u_111.session if v_u_534 ~= v536 then v_u_534 = v536 v_u_533 = nil v_u_535 = false v_u_277.OpponentStats = nil if v_u_289 then v_u_289:Set("Waiting for analysed moves") end if v_u_277.PuzzleRequest ~= v536 then v_u_277.PuzzleRequest = nil end if not v_u_277.Manual then v_u_307() end end if v_u_323(v536) and (v536.over and (v_u_271.AutoRematch and not (v_u_277.Manual or (v_u_111.searching or v_u_111.joining)))) then v_u_533 = v_u_533 or v_u_120() if not v_u_535 and (not v_u_277.Busy and v_u_120() - v_u_533 >= v_u_271.SearchDelay) then v_u_535 = true v_u_461(v536) return end else v_u_533 = nil end if v_u_277.Manual or v_u_277.Busy then return elseif v_u_375(v536) then local v537 = v536.pz if v537.done or (v537.wrong or v536.over) then v_u_277.PuzzleRequest = nil v_u_301() v_u_377(v537.done and "Solved" or "Puzzle ended") v_u_294(v537.done and "Puzzle solved" or "Puzzle ended") return elseif v_u_271.PuzzleAutoSolve or v_u_277.PuzzleRequest == v536 then if v537.busy or not v536:isMyTurn() then v_u_377("Waiting for opponent") return else local v538 = v536.engine:getFen() if v_u_277.PuzzleAttemptedFen ~= v538 then v_u_277.Busy = true local v539, v540 = pcall(v_u_395, v536, v538) v_u_277.Busy = false if not v539 then v_u_277.PuzzleAttemptedFen = v538 v_u_377("Solver error") warn("[Noic RoChess] " .. tostring(v540)) end end end else v_u_301() v_u_377("Ready") v_u_294("Puzzle ready") return end elseif v_u_323(v536) then if v536.over then v_u_301() if (v_u_271.OpponentAnalysis or v_u_271.EngineAlerts) and v536.engine.side == v536.myColor then v_u_422(v536) end v_u_294("Game over") return else local v541 = v536.engine:getFen() if v536:isMyTurn() then v_u_297() if v_u_271.OpponentAnalysis or v_u_271.EngineAlerts then v_u_422(v536) end if v_u_271.AutoPlay or v_u_271.Hints then if v_u_277.ResultFen == v541 then if v_u_271.Hints and v_u_277.Result then v_u_313(v_u_277.Result.best) end return elseif v_u_277.AttemptedFen ~= v541 then v_u_277.Busy = true v_u_294("Searching") local v542, v543 = pcall(v_u_432, v536, v541) v_u_277.Busy = false if not v542 then v_u_277.AttemptedFen = v541 v_u_294("Search error") warn("[Noic RoChess] " .. tostring(v543)) end end else v_u_301() v_u_294("Ready") return end else v_u_301(true) v_u_294("Opponent\'s turn") local v544 = v_u_277.OpponentResult if not v_u_271.OpponentAnalysis or (not v544 or v544.Fen ~= v541) then v_u_297() end if v_u_271.OpponentAnalysis and (v544 and v544.Fen == v541) then v_u_319(v544.Search.best) end if (v_u_271.OpponentAnalysis or v_u_271.EngineAlerts) and (v_u_277.OpponentFen ~= v541 and v_u_277.OpponentAttemptedFen ~= v541) then if not v_u_277.OpponentResult or v_u_277.OpponentResult.Ply ~= #v536.ucis then v_u_287:Set("Analysing opponent") v_u_288:Set("") end v_u_277.Busy = true local v545, v546 = pcall(v_u_417, v536, v541) v_u_277.Busy = false if not v545 then v_u_277.OpponentAttemptedFen = v541 v_u_287:Set("Opponent search failed") warn("[Noic RoChess] " .. tostring(v546)) end end return end end else v_u_301() v_u_294("Ready") return end end) if not v547 then warn("[Noic RoChess] " .. tostring(v548)) task.wait(1) end task.wait(0.15) end end) print("[Noic RoChess]") else v_u_277.Unload() warn("[Noic RoChess] Menu failed: " .. tostring(v532)) end end else warn("[Noic RoChess] Open RoChess before running this script.") return end