Skip to content

Commit cf5363b

Browse files
committed
made necessary changes so the client can work with the server
1 parent 9525267 commit cf5363b

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

client/src/main.client.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ function bestMove() {
5252
const output = findBestMove(
5353
board,
5454
depthSlider.CurrentValue,
55-
thinkTimeSlider.CurrentValue
55+
thinkTimeSlider.CurrentValue,
56+
disregardTimeToggle.CurrentValue
5657
)
5758

5859
task.spawn(() => {
@@ -159,12 +160,20 @@ const depthSlider = mainTab.CreateSlider({
159160
Callback: () => {},
160161
})
161162

162-
// mainTab.CreateSection("")
163+
mainTab.CreateLabel(
164+
"When toggled, Stockfish will not stop thinking until it has reached the desired depth"
165+
)
166+
const disregardTimeToggle = mainTab.CreateToggle({
167+
Name: "Disregard Think Time",
168+
CurrentValue: false,
169+
Flag: "DisregardThinkTime",
170+
Callback: () => {},
171+
})
163172

164173
// mainTab.CreateLabel("Maximum amount of time Stockfish has to think")
165174
const thinkTimeSlider = mainTab.CreateSlider({
166-
Name: "Max Think Time",
167-
Range: [100, 5_000],
175+
Name: "Think Time",
176+
Range: [10, 5_000],
168177
CurrentValue: 100,
169178
Flag: "MaxThinkTime",
170179
Suffix: "ms",

client/src/utils/findBestMove.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ interface MoveJsonData {
1414
export = (
1515
board: Board,
1616
depth: number,
17-
maxThinkTime: number
17+
maxThinkTime: number,
18+
disregardThinkTime: boolean
1819
): [boolean, string, Instance?, Instance?] => {
1920
if (!board.isPlayerTurn()) return [false, "not your turn"]
2021

@@ -27,7 +28,8 @@ export = (
2728
"http://127.0.0.1:3000/api/solve?fen=" + // localhost is the same as this but Wave flags it as dangerous
2829
HttpService.UrlEncode(board.board2fen()!) +
2930
`&depth=${depth}` +
30-
`&max_think_time=${maxThinkTime}`
31+
`&max_think_time=${maxThinkTime}` +
32+
`&disregard_think_time=${disregardThinkTime}`
3133
)
3234
// eslint-disable-next-line roblox-ts/lua-truthiness
3335
if (!ret) {

0 commit comments

Comments
 (0)