imwithye commited on
Commit
3785729
·
1 Parent(s): 6371c28
Files changed (2) hide show
  1. rlcube/main.py +1 -1
  2. src/components/ui-controls.tsx +4 -0
rlcube/main.py CHANGED
@@ -25,7 +25,7 @@ def solve(body: StateArgs):
25
 
26
  env = Cube2Env()
27
  env.reset(state=np.array(state, dtype=np.int8))
28
- tree = MonteCarloTree(env.obs(), max_simulations=300)
29
  if tree.is_solved:
30
  return {"steps": [action for _, action in tree.solved_path]}
31
  raise HTTPException(status_code=422, detail="Unable to solve the cube")
 
25
 
26
  env = Cube2Env()
27
  env.reset(state=np.array(state, dtype=np.int8))
28
+ tree = MonteCarloTree(env.obs(), max_simulations=2048)
29
  if tree.is_solved:
30
  return {"steps": [action for _, action in tree.solved_path]}
31
  raise HTTPException(status_code=422, detail="Unable to solve the cube")
src/components/ui-controls.tsx CHANGED
@@ -39,6 +39,7 @@ export const UIControls = () => {
39
 
40
  const reset = () => {
41
  rubiksCubeRef?.current?.reset();
 
42
  };
43
 
44
  const showState = () => {
@@ -60,6 +61,9 @@ export const UIControls = () => {
60
  },
61
  body: JSON.stringify({ state: rotationController.getState() }),
62
  });
 
 
 
63
  if (response.status === 422) {
64
  alert('Unable to solve the cube.');
65
  return;
 
39
 
40
  const reset = () => {
41
  rubiksCubeRef?.current?.reset();
42
+ setIsSolving(false);
43
  };
44
 
45
  const showState = () => {
 
61
  },
62
  body: JSON.stringify({ state: rotationController.getState() }),
63
  });
64
+ if (!isSolving) {
65
+ return;
66
+ }
67
  if (response.status === 422) {
68
  alert('Unable to solve the cube.');
69
  return;