Advertisement
Guest User

I think I finally fixed everything (CSP Solver)

a guest
Dec 22nd, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 0.38 KB | None | 0 0
  1. import nimconstraint, sequtils, math
  2.  
  3. let catalanConjecture = newProblem[int64]()
  4.  
  5. catalanConjecture.define:
  6.     X in toSeq(2'i64..15'i64)
  7.     Y in toSeq(2'i64..15'i64)
  8.  
  9. catalanConjecture.constrain:
  10.     (X ^ Y) == (Y ^ X) - 1
  11.  
  12. echo catalanConjecture.search # X = 2, Y = 3
  13.  
  14. catalanConjecture.constrain:
  15.     X > 2
  16.     Y > 3
  17.  
  18. echo catalanConjecture.search # No Solutions
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement