Commit Graph

60 Commits

Author SHA1 Message Date
David Wang
b5851e6876 Add solution type.
When a valid solution has been found, we will create a Solution
structure.  The values assigned to the puzzle variables can be
accessed using the indexing notation: solution[var].
2017-02-20 08:07:00 +11:00
David Wang
859e7c7341 Add convenience functions for creating puzzle variables. 2017-02-19 09:03:01 +11:00
David Wang
9464629ca1 Add operations to manipulate candidates.
We have chosen to store candidates in a BTreeSet rather than a HashSet
so that iteration will be deterministic, not randomised.
2017-02-19 08:58:17 +11:00
David Wang
33ed1a3dbb Add types for a single candidate and a set of candidates.
Candidates are always an i32 (rather than a generic integer type) to
more easily perform arithmetic.  The puzzles we will deal with should
always be small enough such that we do not exceed the limits of i32.

Candidate groups are separated into an enum.  This is to help us keep
it general, as we would like to include a range option in the future.
2017-02-19 08:38:58 +11:00
David Wang
dbd4a9b5c8 Add puzzle variable tokens.
We have chosen to return a variable token for every variable created,
instead of referencing puzzle variables by string or something else.
Puzzle variables should only be used in the puzzle that created it,
though this is neither checked nor enforced.

Eventually, we would also like to overload the standard arithmetic
symbols to ergonomically build constraint expressions.
2017-02-19 08:11:13 +11:00
David Wang
242dd19fca Add puzzle type. 2017-02-19 08:03:29 +11:00
David Wang
c62c26aafd Add dependency: bit-set.
We will be using bit-sets to keep track of which puzzle variables are
used in which constraints, and which constraints need to be woken up.
2017-02-18 16:05:10 +11:00
David Wang
eebe23f2e0 Add Travis CI metadata.
Copied from crates.io/travis-ci Rust guide.
2017-02-18 08:28:20 +11:00
David Wang
d969b43099 Add licence (MIT). 2017-02-18 08:25:56 +11:00
David Wang
11f6cd7395 Initial commit: puzzle solver. 2017-02-18 08:21:54 +11:00