Advertisement
jarekmor

Tree of Thought - 3x3 sudoku experiment

May 29th, 2023 (edited)
1,428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.62 KB | None | 0 0
  1. (.venv) jarekmor@DESKTOP-JVA0A1H:~/python_projects/tree-of-thought-puzzle-solver$ python run_tot.py "please solve this 3x3 sudoku puzzle [[1, *, *], [*, 1, *], [*, 2, *]] where * represents a cell to be filled in."
  2.  
  3. LLM Query: [{'role': 'user', 'content': 'The user is asking "please solve this 3x3 sudoku puzzle [[1, *, *], [*, 1, *], [*, 2, *]] where * represents a cell to be filled in.". What type of problem the user wants to solve? Please give the answer in the following JSON format: { "problem_type": "<problem_type>" } where <problem_type> can only be "sudoku", "3sat", or "others".'}]
  4. LLM Reply: { "problem_type": "sudoku" }
  5.  
  6. LLM Query: [{'role': 'user', 'content': 'please solve this 3x3 sudoku puzzle [[1, *, *], [*, 1, *], [*, 2, *]] where * represents a cell to be filled in. Before solving this Sudoku puzzle, please return its initial board configuration in the following JSON format: { "rows": [] }. Please use "*" to represent the missing values. Do not provide a solution yet.'}]
  7. LLM Reply: { "rows": [["1", "*", "*"], ["*", "1", "*"], ["*", "2", "*"]] }
  8.  
  9. State History:
  10.         State: [["1", "*", "*"], ["*", "1", "*"], ["*", "2", "*"]]
  11. max_rollback_steps: 0
  12. parent_state_visit_count: 0
  13. ROLLBACK STEPS: 0
  14.  
  15. LLM Query: [{'role': 'user', 'content': '"Here is an example showing how to solve a 3x3 Sudoku puzzle [[*, 3, 1], [*, 2, 3], [3, *, 2]]. First, notice that the only missing number in the first row is 2, so we can fill in the first cell in the first row with 2.\\n\\nSimilarly, the first cell in the second row should be 2. Finally, the only missing number in the second column is 1. Hence, we can fill that cell with 1.In conclusion, the puzzle solution is [[2, 3, 1], [1, 2, 3], [3, 1, 2]].\\n\\n" Please try to solve this Sudoku puzzle [[\'1\', \'*\', \'*\'], [\'*\', \'1\', \'*\'], [\'*\', \'2\', \'*\']]. In the next solution you return, please just fill in a few cells since we will work together to solve the puzzle in multiple rounds of conversation. Please return your solution in the following JSON format: { "rows": [] }'}]
  16. LLM Reply: {
  17.  "rows": [
  18.    ["1", "3", "2"],
  19.    ["2", "1", "3"],
  20.    ["3", "2", "1"]
  21.  ]
  22. }
  23.  
  24.  
  25. VISIT COUNT for [["1", "*", "*"], ["*", "1", "*"], ["*", "2", "*"]]: 1
  26.  
  27. State History:
  28.        State: [["1", "*", "*"], ["*", "1", "*"], ["*", "2", "*"]]
  29.        State: [["1", "3", "2"], ["2", "1", "3"], ["3", "2", "1"]]
  30. max_rollback_steps: 1
  31. parent_state_visit_count: 1
  32. ROLLBACK STEPS: 1
  33.  
  34. [{'role': None, 'content': 'Fantastic! You have found the solution [["1", "3", "2"], ["2", "1", "3"], ["3", "2", "1"]]!'}]
  35.  
  36. Success : True
  37. Solution: [['1', '3', '2'], ['2', '1', '3'], ['3', '2', '1']]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement