2 Commits

Author SHA1 Message Date
David Wang
fcefa40b6c Add all different constraint.
This is a very simple all different constraint, e.g.

- It does not know that if there are more variables than candidates,
  it has reached a contradiction.

- It does not know that, if there are as many variables as candidates,
  if only one variable can take on a candidate value, then all other
  candidates for that variable can be eliminated.
2017-02-23 07:53:26 +11:00
David Wang
651cc9f6c7 Add constraint trait.
Each constraint is a little sub-program that attempts to reduce the
search space.  They should only be run as required, i.e. when the
candidates of the variables they use were updated, though this has not
yet been implemented.

Constraints are traits so that puzzles may implement their own
specialised contraints as required.  We have split the trait into an
"on_assigned" call and an "on_updated" call for clarity.  The provided
methods simply return true, indicating no contradiction.
2017-02-21 08:24:59 +11:00