def make_NQueens_CSP(n):
 vars = list(range(n))
 domains = list(range(n))
 neighbors = {}
 for v in vars:
  neighbors[v] = vars[:]
  neighbors[v].remove(v)
 return NQueensCSP(vars=vars, domains=defaultdict((lambda : domains)), neighbors=neighbors, binary_constraint=queens_constraint)

def make_NQueens_CSP ( n ) : vars = list ( range ( n ) ) domains = list ( range ( n ) ) neighbors = { } for v in vars : neighbors [ v ] = vars [ : ] neighbors [ v ] . remove ( v ) return NQueensCSP ( vars = vars , domains = defaultdict ( ( lambda : domains ) ) , neighbors = neighbors , binary_constraint = queens_constraint )
creates a n-queens csp problem for a given n .