Run it
Copy the script and paste it into your executor.
Players = :()
UserInputService = :()
ReplicatedStorage = :()
LocalPlayer = Players.LocalPlayer
Chess = ReplicatedStorage:()
Client = ReplicatedStorage:()
(mod)
(mod)
Engine = (Chess:())
Bot = (Chess:())
VortexBot = (Chess:())
App = (Client:())
GENV = ()
GENV.__RoCheeseGen = (GENV.__RoCheeseGen ) +
GEN = GENV.__RoCheeseGen
CFG = {
W = ,
H = ,
MARGIN = ,
TOP = ,
DEPTH = ,
SECONDS = ,
CHILD_DEPTH = ,
CHILD_SECONDS = ,
VK_SHIFT = ,
PROMO = { q = , r = , b = , n = },
ARROW_1 = .(, , ),
ARROW_2 = .(, , ),
ARROW_3 = .(, , ),
DELAY_MIN = ,
DELAY_MAX = ,
DELAY_STEP = ,
}
PRESETS = {
legit = {
label = ,
source = ,
mode = ,
elo = ,
noise = ,
blunder = ,
delayMin = ,
delayMax = ,
},
raj = {
label = ,
source = ,
mode = ,
elo = ,
noise = ,
blunder = ,
delayMin = ,
delayMax = ,
},
}
RUNTIME = GENV.__RoCheese {}
RUNTIME.SHOW_ARROW = RUNTIME.SHOW_ARROW ~=
RUNTIME.AUTO = RUNTIME.AUTO ==
RUNTIME.HUMANIZE = RUNTIME.HUMANIZE ~=
RUNTIME.SOURCE = RUNTIME.SOURCE ==
RUNTIME.MODE = RUNTIME.MODE ==
RUNTIME.ELO = (RUNTIME.ELO)
RUNTIME.NOISE = (RUNTIME.NOISE)
RUNTIME.BLUNDER = (RUNTIME.BLUNDER)
RUNTIME.DELAY_MIN = .((RUNTIME.DELAY_MIN) , CFG.DELAY_MIN, CFG.DELAY_MAX)
RUNTIME.DELAY_MAX = .((RUNTIME.DELAY_MAX) , CFG.DELAY_MIN, CFG.DELAY_MAX)
RUNTIME.STYLE = RUNTIME.STYLE == (RUNTIME.STYLE == )
GENV.__RoCheese = RUNTIME
ARROW_KEYS = { , , }
S = {
ply = -,
sessionId = ,
best = ,
san = ,
score = ,
depth = ,
second = ,
third = ,
secondSan = ,
thirdSan = ,
busy = ,
autoAt = ,
thinkAt = ,
status = ,
}
GENV.__RoCheeseState = S
LIVE = .STATE
()
GENV.__RoCheeseGen ~= GEN
(LIVE) == (LIVE.alive) ==
LIVE.()
(fn)
(LIVE) == (LIVE.onCleanup) ==
LIVE.(fn)
()
board = App.board
board (board.setArrow) ~=
_, key ARROW_KEYS
(()
board:(key, )
board:(key, )
)
(()
board:(, )
board:(, )
)
(key, uci, color, tint)
board = App.board
board
from = Engine.(uci:(, ))
to = Engine.(uci:(, ))
from to
(()
board:(key, from, to, color, )
tint
board:(key, to, color, )
)
(startFen, moves)
engine = Engine.(startFen)
_, uci (moves)
mv = engine:(uci)
mv
engine:(mv)
engine
(engine, uci)
engine uci
want = .(uci)
_, mv engine:()
u = engine:(mv)
u .(u) == want
engine:(mv)
(startFen, moves)
RUNTIME.SOURCE ==
ok, res = (VortexBot.analyse, startFen, moves, CFG.SECONDS, CFG.DEPTH)
ok (res) == res.best
res
ok, res = (Bot.analyse, startFen, moves, CFG.SECONDS, CFG.DEPTH)
ok (res) ==
res
(startFen, moves, skipUci)
engine = (startFen, moves)
engine
scored = {}
_, mv engine:()
uci = engine:(mv)
skipUci .(uci) ~= .(skipUci)
child = Engine.(startFen)
ok = (()
child:(uci)
)
ok
cres = Bot.(child:(), {}, CFG.CHILD_SECONDS, CFG.CHILD_DEPTH)
.(scored, {
uci = uci,
san = engine:(mv),
score = (cres cres.score) ,
})
.(scored, (a, b)
a.score > b.score
)
scored
(session)
RUNTIME.MODE ==
ok, uci = (Bot.think, session.startFen, .(session.ucis), {
rating = RUNTIME.ELO,
noise = RUNTIME.NOISE,
blunder = RUNTIME.BLUNDER,
time = ,
depth = ,
})
ok (uci) ==
uci
S.best
()
RUNTIME.HUMANIZE
(keyclick) ~=
(isrbxactive) == ()
(keyclick, CFG.VK_SHIFT)
(uci)
session = App.session
session session.over
,
session:()
,
from = Engine.(uci:(, ))
to = Engine.(uci:(, ))
from to
,
promo = CFG.PROMO[uci:(, )]
before = #session.ucis
()
ok =
(()
ok = App.(from, to, promo, )
)
ok #session.ucis == before
(()
App.(uci)
)
, uci
()
lo = .(RUNTIME.DELAY_MIN, RUNTIME.DELAY_MAX)
hi = .(RUNTIME.DELAY_MIN, RUNTIME.DELAY_MAX)
hi - lo <
lo
lo + .() * (hi - lo)
(session, ply)
RUNTIME.AUTO
session.over session:()
session.viewPly ~= ply S.busy S.best
now = .()
now < S.thinkAt
uci = (session)
(uci) ~=
.(()
()
App.session == session session.over session:()
(uci)
)
gui =
panel =
rows = {}
btns = {}
dot =
dragged =
lastEval =
toggleAuto, playNow, copyPosition, refreshButtons, syncDelay, applyPreset, startBotGame
C_BG = .(, , )
C_IDLE = .(, , )
C_ON = .(, , )
C_RAJ = .(, , )
C_TXT = .(, , )
C_DIM = .(, , )
C_ACC = .(, , )
(parent, y, h, size, color, bold, x)
t = .()
t.BackgroundTransparency =
t.Size = .(CFG.W - - (x ), h)
t.Position = .(x , y)
t.Font = bold .Font.GothamBold .Font.Gotham
t.TextSize = size
t.TextColor3 = color
t.TextXAlignment = .TextXAlignment.Left
t.TextYAlignment = .TextYAlignment.Center
t.TextTruncate = .TextTruncate.AtEnd
t.Parent = parent
t
(y, h, text, width, onClick)
b = .()
b.BackgroundColor3 = C_IDLE
b.BorderSizePixel =
b.AutoButtonColor =
b.Size = .(width (CFG.W - ), h)
b.Position = .(, y)
b.Font = .Font.GothamBold
b.TextSize =
b.TextColor3 = C_TXT
b.Text = text
b.Parent = panel
c = .()
c.CornerRadius = .(, )
c.Parent = b
s = .()
s.Color = .(, , )
s.Thickness =
s.Transparency =
s.Parent = b
b.MouseButton1Click:(onClick)
b.MouseEnter:(()
s.Transparency =
)
b.MouseLeave:(()
s.Transparency =
)
b
(b, on, text, onColor)
b.BackgroundColor3 = on (onColor C_ON) C_IDLE
b.Text = text
(y)
sep = .()
sep.BackgroundColor3 = .(, , )
sep.BackgroundTransparency =
sep.BorderSizePixel =
sep.Size = .(CFG.W - , )
sep.Position = .(, y)
sep.Parent = panel
sep
(x, y, color, size)
d = .()
d.BackgroundColor3 = color
d.BorderSizePixel =
d.Size = .(size , size )
d.Position = .(x, y)
d.Parent = panel
c = .()
c.CornerRadius = .(, )
c.Parent = d
d
(y)
row = .()
row.BackgroundTransparency =
row.Size = .(CFG.W - , )
row.Position = .(, y)
row.Parent = panel
title = .()
title.BackgroundTransparency =
title.Size = .(, )
title.Text =
title.Font = .Font.GothamBold
title.TextSize =
title.TextColor3 = C_DIM
title.TextXAlignment = .TextXAlignment.Left
title.Parent = row
values = {}
(x, name, getVal, setVal)
lab = .()
lab.BackgroundTransparency =
lab.Size = .(, )
lab.Position = .(x, )
lab.Text = name
lab.Font = .Font.GothamBold
lab.TextSize =
lab.TextColor3 = C_DIM
lab.TextXAlignment = .TextXAlignment.Left
lab.Parent = row
(px, sign)
b = .()
b.BackgroundColor3 = C_IDLE
b.BorderSizePixel =
b.AutoButtonColor =
b.Size = .(, )
b.Position = .(px, )
b.Font = .Font.GothamBold
b.TextSize =
b.TextColor3 = C_TXT
b.Text = sign
b.Parent = row
c = .()
c.CornerRadius = .(, )
c.Parent = b
s = .()
s.Color = .(, , )
s.Thickness =
s.Transparency =
s.Parent = b
holding =
()
(() + (sign == CFG.DELAY_STEP -CFG.DELAY_STEP))
b.MouseButton1Down:(()
holding =
()
.(()
.()
reps =
holding reps <
()
reps +=
.()
)
)
b.MouseButton1Up:(()
holding =
)
b.MouseLeave:(()
holding =
)
b
value = .()
value.BackgroundTransparency =
value.Size = .(, )
value.Position = .(x + , )
value.Font = .Font.GothamBold
value.TextSize =
value.TextColor3 = C_TXT
value.TextXAlignment = .TextXAlignment.Center
value.Parent = row
values[name] = value
(x + , )
(x + , )
(, , ()
RUNTIME.DELAY_MIN
, (v)
RUNTIME.DELAY_MIN = .(v, CFG.DELAY_MIN, RUNTIME.DELAY_MAX - CFG.DELAY_STEP)
RUNTIME.STYLE =
()
()
)
(, , ()
RUNTIME.DELAY_MAX
, (v)
RUNTIME.DELAY_MAX = .(v, RUNTIME.DELAY_MIN + CFG.DELAY_STEP, CFG.DELAY_MAX)
RUNTIME.STYLE =
()
()
)
()
values.MIN.Text = .(, RUNTIME.DELAY_MIN)
values.MAX.Text = .(, RUNTIME.DELAY_MAX)
()
layout
()
playerGui = LocalPlayer:()
old = playerGui:()
old
old:()
gui = .()
gui.Name =
gui.ResetOnSpawn =
gui.IgnoreGuiInset =
gui.DisplayOrder =
gui.ZIndexBehavior = .ZIndexBehavior.Sibling
gui.Parent = playerGui
panel = .()
panel.Name =
panel.BackgroundColor3 = C_BG
panel.BackgroundTransparency =
panel.BorderSizePixel =
panel.Size = .(CFG.W, CFG.H)
panel.Position = .( - CFG.W - CFG.MARGIN, CFG.TOP)
panel.Active =
panel.Parent = gui
corner = .()
corner.CornerRadius = .(, )
corner.Parent = panel
stroke = .()
stroke.Color = C_ACC
stroke.Thickness =
stroke.Transparency =
stroke.Parent = panel
rows.title = (panel, , , , C_ACC, )
rows.title.Size = .(CFG.W - , )
dot = (CFG.W - , , C_DIM)
rows.status = (panel, , , , C_DIM)
rows.eval = (panel, , , , C_TXT, )
rows.best = (panel, , , , C_TXT)
rows.rest = (panel, , , , C_DIM)
rows.game = (panel, , , , C_DIM)
()
half = .((CFG.W - ) / )
btns.legit = (, , , half, ()
()
)
btns.raj = (, , , half, ()
()
)
btns.raj.Position = .( + half, )
syncDelay = ()
btns.best = (, , , half, ()
RUNTIME.MODE = RUNTIME.MODE ==
RUNTIME.STYLE =
()
)
btns.elo = (, , , half, ()
RUNTIME.MODE = RUNTIME.MODE ==
RUNTIME.STYLE =
()
)
btns.elo.Position = .( + half, )
btns.engineLocal = (, , , half, ()
RUNTIME.SOURCE = RUNTIME.SOURCE ==
RUNTIME.STYLE =
S.ply = -
()
)
btns.engineVortex = (, , , half, ()
RUNTIME.SOURCE = RUNTIME.SOURCE ==
RUNTIME.STYLE =
S.ply = -
()
)
btns.engineVortex.Position = .( + half, )
btns.auto = (, , , , ()
()
)
btns.play = (, , , half, ()
()
)
btns.copy = (, , , half, ()
()
)
btns.copy.Position = .( + half, )
btns.botgame = (, , , , ()
()
)
()
(, , CFG.ARROW_1, )
l1 = .()
l1.BackgroundTransparency =
l1.Size = .(, )
l1.Position = .(, )
l1.Font = .Font.Gotham
l1.TextSize =
l1.TextColor3 = C_TXT
l1.Text =
l1.Parent = panel
(, , CFG.ARROW_2, )
l2 = .()
l2.BackgroundTransparency =
l2.Size = .(, )
l2.Position = .(, )
l2.Font = .Font.Gotham
l2.TextSize =
l2.TextColor3 = C_TXT
l2.Text =
l2.Parent = panel
(, , CFG.ARROW_3, )
l3 = .()
l3.BackgroundTransparency =
l3.Size = .(, )
l3.Position = .(, )
l3.Font = .Font.Gotham
l3.TextSize =
l3.TextColor3 = C_TXT
l3.Text =
l3.Parent = panel
rows.hint = (panel, , , , .(, , ))
rows.hint.Text =
dragging =
dragFrom = .zero
dragStart = .(, )
rows.title.Active =
rows.title.InputBegan:((input)
input.UserInputType == .UserInputType.MouseButton1 input.UserInputType == .UserInputType.Touch
dragging =
dragged =
dragFrom = .(input.Position.X, input.Position.Y)
dragStart = panel.Position
)
rows.title.InputChanged:((input)
dragging
input.UserInputType == .UserInputType.MouseMovement input.UserInputType == .UserInputType.Touch
cam = .CurrentCamera
vp = cam cam.ViewportSize .(, )
delta = .(input.Position.X - dragFrom.X, input.Position.Y - dragFrom.Y)
x = .(dragStart.X.Offset + delta.X, , .(, vp.X - CFG.W))
y = .(dragStart.Y.Offset + delta.Y, , .(, vp.Y - CFG.H))
panel.Position = .(x, y)
)
rows.title.InputEnded:(()
dragging =
)
(()
gui
gui:()
gui =
panel =
)
refreshButtons = ()
btns.auto
(btns.auto, RUNTIME.AUTO, RUNTIME.AUTO )
(btns.legit, RUNTIME.STYLE == , , C_ON)
(btns.raj, RUNTIME.STYLE == , , C_RAJ)
(btns.best, RUNTIME.MODE == , )
(btns.elo, RUNTIME.MODE == , .. RUNTIME.ELO)
(btns.engineLocal, RUNTIME.SOURCE == , )
(btns.engineVortex, RUNTIME.SOURCE == , )
(dx, dy)
panel panel.Parent
cam = .CurrentCamera
vp = cam cam.ViewportSize .(, )
x = .(panel.Position.X.Offset + dx, , .(, vp.X - CFG.W))
y = .(panel.Position.Y.Offset + dy, , .(, vp.Y - CFG.H))
panel.Position = .(x, y)
dragged =
()
dragged panel panel.Parent
cam = .CurrentCamera
vp = cam cam.ViewportSize .(, )
panel.Position = .(vp.X - CFG.W - CFG.MARGIN, CFG.TOP)
toggleAuto = ()
RUNTIME.AUTO = RUNTIME.AUTO
S.thinkAt = .() + (RUNTIME.AUTO () )
S.status = RUNTIME.AUTO
()
playNow = ()
session = App.session
session
S.status =
S.busy S.best
S.status =
uci = (session)
(uci) ~=
S.status =
ok, err = (uci)
S.status = ok ( .. (err)) (err)
copyPosition = ()
session = App.session
session
S.status =
fen = session.engine:()
sans = .(session.sans, )
(setclipboard, fen .. .. sans)
S.status =
startBotGame = ()
ok, err = (()
App.(, )
)
S.status = ok ( .. (err))
applyPreset = (name)
preset = PRESETS[name]
preset
RUNTIME.STYLE = name
RUNTIME.SOURCE = preset.source
RUNTIME.MODE = preset.mode
RUNTIME.ELO = preset.elo
RUNTIME.NOISE = preset.noise
RUNTIME.BLUNDER = preset.blunder
RUNTIME.DELAY_MIN = preset.delayMin
RUNTIME.DELAY_MAX = preset.delayMax
S.ply = -
S.status = name ..
syncDelay
()
()
setDelay = (lo, hi)
lo = .((lo) RUNTIME.DELAY_MIN, CFG.DELAY_MIN, CFG.DELAY_MAX)
hi = .((hi) RUNTIME.DELAY_MAX, CFG.DELAY_MIN, CFG.DELAY_MAX)
hi < lo
lo, hi = hi, lo
RUNTIME.DELAY_MIN = .(lo / CFG.DELAY_STEP + ) * CFG.DELAY_STEP
RUNTIME.DELAY_MAX = .(hi / CFG.DELAY_STEP + ) * CFG.DELAY_STEP
RUNTIME.DELAY_MAX - RUNTIME.DELAY_MIN < CFG.DELAY_STEP
RUNTIME.DELAY_MAX = RUNTIME.DELAY_MIN + CFG.DELAY_STEP
RUNTIME.STYLE =
syncDelay
()
()
(input, processed)
processed UserInputService:()
code = input.KeyCode
code == .KeyCode.End
()
code == .KeyCode.Home
RUNTIME.SHOW_ARROW = RUNTIME.SHOW_ARROW
RUNTIME.SHOW_ARROW
()
()
code == .KeyCode.PageUp
gui
gui.Enabled = gui.Enabled
code == .KeyCode.PageDown
RUNTIME.SOURCE = RUNTIME.SOURCE ==
RUNTIME.STYLE =
S.ply = -
()
code == .KeyCode.Insert
()
prevConn = GENV.__RoCheeseConn
prevConn
(()
prevConn:()
)
conn = UserInputService.InputBegan:(onKey)
GENV.__RoCheeseConn = conn
(()
conn:()
)
GAME_KINDS = {
bot = ,
online = ,
puzzle = ,
rush = ,
}
()
session = App.session
kind = session session.kind
session kind GAME_KINDS[kind]
lastEval =
S.busy S.best
score = S.score
lastEval == score
lastEval = score
mate =
.(score) >=
mate = .(, .(( - .(score)) / + ))
(()
App.(score, mate)
)
(ms)
(ms) ~=
ms = .(, ms)
total = .(ms / )
.(, .(total / ), total % )
(score)
abs = .(score)
abs >=
moves = .(, .(( - abs) / + ))
.(, moves, score > )
pawns = score /
.(, pawns >= , pawns)
(session, ply)
panel panel.Parent
rows.title.Text =
rows.status.Text = S.status
rows.eval.Text = session
(S.busy .(, (S.score), S.depth))
S.busy
rows.best.Text =
rows.rest.Text =
rows.best.Text = S.best .(, S.san , S.best)
parts = {}
S.second
.(parts, .(, S.secondSan S.second))
S.third
.(parts, .(, S.thirdSan S.third))
rows.rest.Text = .(parts, )
myClock, oppClock = ,
session session.clocks session.myColor
myClock = (session.clocks[session.myColor])
oppClock = (session.clocks[-session.myColor])
rows.game.Text = session
.(,
session.myColor == (session.white session.white.display )
(session.black session.black.display ),
ply,
myClock,
oppClock)
session session.kind ==
rows.status.Text =
dot
S.busy
dot.BackgroundColor3 = C_ACC
S.best
dot.BackgroundColor3 = CFG.ARROW_1
dot.BackgroundColor3 = .(, , )
()
()
()
S.status =
GENV.__RoCheese.api = {
auto = toggleAuto,
play = playNow,
copy = copyPosition,
move = shiftPanel,
= setDelay,
preset = applyPreset,
state = ()
{
ply = S.ply,
best = S.best,
san = S.san,
second = S.second,
third = S.third,
score = S.score,
depth = S.depth,
status = S.status,
auto = RUNTIME.AUTO,
style = RUNTIME.STYLE,
source = RUNTIME.SOURCE,
mode = RUNTIME.MODE,
delayMin = RUNTIME.DELAY_MIN,
delayMax = RUNTIME.DELAY_MAX,
}
,
}
.(()
()
session = App.session
ply = session #session.ucis -
sid = session session.id
session sid ~= S.sessionId
S.sessionId = sid
lastEval =
(()
Bot.()
)
session ply ~= S.ply
S.ply = ply
S.thinkAt = .() + ()
S.best =
S.san =
S.second =
S.third =
S.secondSan =
S.thirdSan =
()
S.busy
S.busy =
startFen = session.startFen
moves = .(session.ucis)
wantPly = ply
.(()
res = (startFen, moves)
()
S.busy =
live = App.session
live #live.ucis ~= wantPly
S.ply = -
(res) ~=
S.status =
S.best = res.best
S.score = (res.score)
S.depth = (res.depth)
S.status =
engine = (startFen, moves)
S.san = (engine, res.best)
.(()
ranked = (startFen, moves, res.best)
()
live2 = App.session
live2 #live2.ucis ~= wantPly ranked
S.second = ranked[] ranked[].uci
S.secondSan = ranked[] ranked[].san
S.third = ranked[] ranked[].uci
S.thirdSan = ranked[] ranked[].san
)
)
session
live = RUNTIME.SHOW_ARROW session.viewPly == ply session.over
live
S.best
(ARROW_KEYS[], S.best, CFG.ARROW_1, )
S.second
(ARROW_KEYS[], S.second, CFG.ARROW_2, )
S.third
(ARROW_KEYS[], S.third, CFG.ARROW_3, )
()
(session, ply)
(session, ply)
()
.()
)
(clearArrows)
()auto play (rage and legit) you can change delay between moves 3 arrows green blue and yellow show where to move Vortex is slower but better than local

RoChess!