Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.24 KB | None | 0 0
  1. from sys import argv
  2. import os
  3.  
  4.  
  5. script, variable, constraint, consistency = argv
  6.  
  7. """variableFile = open(variable, "r")
  8. constraintFile = open(constraint, "r")
  9. consistencyFile = open(consistency, "r")
  10. d = {}
  11. varList = variableFile.read()
  12. varList = varList.replace(" ", "")
  13. varList = varList.replace(":", "")
  14. for line in varList:
  15.    (key, val) = line.split()
  16.    d[str(key)] = val
  17. print(varList)
  18. """
  19. with open(variable, 'r') as variableFile:
  20.     answer = {}
  21.     varNum = sum(1 for line in open(variable))
  22.     for x in range(1, varNum):
  23.         line = variableFile.readline()
  24.         line = line.replace(':', '')
  25.         line = line.split()
  26.         if not line:
  27.             continue
  28.         answer[line[0]] = line[1:]
  29.     #print(variableFile.read())
  30.     #answer = answer.replace(":", "")
  31. print(answer)
  32. with open(constraint, 'r') as constraintFile:
  33.     print(constraintFile.read())
  34.  
  35. with open(consistency, 'r') as consistencyFile:
  36.     print(consistencyFile.read())
  37.  
  38.  
  39.  
  40.  
  41. """def backtrack_search(csp):
  42.    return recursive-backtrack({}, csp)
  43.  
  44. def recursive_backtrack(assignment, csp):
  45.    if (assignment == complete): return assignment
  46.    variable = select_unassigned_variable(Variable[csp], assignment, csp)
  47.    return solution"""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement