csp_solver.py 782 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env python3
  2. from sudoku import Game, printBoard, setValue, getBoard
  3. MAX_V = 10
  4. class Solver:
  5. def __init__(self):
  6. self.tree = {}
  7. choices = set()
  8. board = []
  9. # Populate the choice vector with values from 0 to MAX_V-1
  10. for x in range(MAX_V)
  11. choices.add(str(x))
  12. # Creates a bidimensional list with choices for every element
  13. for x in range(MAX_V):
  14. row = []
  15. for y in range(MAX_V):
  16. row.append(choices)
  17. board.append(row)
  18. self.board = board
  19. result = getBoard()
  20. def actions(state):
  21. def result(state,action):
  22. def goalTest(state):
  23. if __name__ == "__main__":
  24. while not goalTest(state):
  25. for action in actions(node):