358175fd33
Fix & fmt & ci
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2022-03-09 12:42:09 +04:00
656890c1be
Refactored variable constructors
2021-12-10 13:20:36 +04:00
d8323a144f
Move LinExpr into linexpr module
2021-12-09 22:48:36 +04:00
25a6634069
on_assing -> propagate
2021-12-09 22:36:40 +04:00
e363a552f0
Split out Ranges struct
2021-12-09 22:26:07 +04:00
ba86c49bfb
Ranges
2021-12-08 18:50:21 +04:00
631d25cc3c
fix warnings
2021-12-08 11:17:32 +04:00
da22e1dfbb
fmt
2021-12-07 20:56:04 +04:00
74ea9c497f
Edition 2021
2021-12-07 20:49:40 +04:00
David Wang
2f20aa4086
Add test: Takuzu (A.K.A. Binairo).
...
takuzu_grid1: 12 guesses.
takuzu_grid2: 0 guesses.
takuzu_grid3: 0 guesses.
takuzu_grid4: 20724 guesses (all solutions).
2017-03-21 08:44:26 +11:00
David Wang
b22c6466ca
Add test: Nonogram (A.K.A. Hanjie, Picross).
...
nonogram_wikipedia: 10 guesses.
2017-03-20 08:31:09 +11:00
David Wang
f22b271000
Clean up.
...
- Use cloned instead of map.
- Use Val instead of i32.
- Import module instead of trait.
2017-03-18 09:22:52 +11:00
David Wang
630f09fc80
Add test: xkcd knapsack problem.
...
xkcd_knapsack: 60 guesses.
2017-03-17 08:45:57 +11:00
David Wang
65222f24d1
Update test: Samurai Sudoku.
...
samuraisudoku_easy: 2 -> no guesswork!
2017-03-12 08:07:31 +11:00
David Wang
035a8fc8a4
Clean up: candidate manipulation returns a Result.
...
Functions to manipulate candidates during the solution search now
always return a Result instead of sometimes returning a bool, and
other times returning an Option.
We opted to use Result over Option mainly to (ab)use the try! macro.
In addition, it also makes it emit a warning when we forget to handle
the result. (We tend to assume people don't just ignore the result
and continue as normal, instead of putting the puzzle in a special
contradiction detected state.)
2017-03-11 09:40:20 +11:00
David Wang
5bb52b03f2
Add simple variable substitution for constraints.
...
Constraints must now implement the substitution of "from" with "to".
The implementations can be sanity checked when we come to build the
list of constraints that each variable wakes up.
In the future, we would like to make the more general substitution:
from -> scale * to + constant.
2017-03-09 07:52:08 +11:00
David Wang
ddf425efe0
Automatically box constraints.
...
Puzzle.add_constraint() now takes a generic (unboxed) constraint,
making it more pleasant to use when adding custom constraints.
2017-03-08 07:57:19 +11:00
David Wang
6689b0106f
Add test: Samurai Sudoku.
...
samuraisudoku_easy: 2 guesses.
2017-03-06 07:53:10 +11:00
David Wang
23ae2331bf
Add test: Killer Sudoku.
...
killersudoku_wikipedia: 7 guesses.
2017-03-04 09:07:04 +11:00
David Wang
c93b9430c1
Add test: Kakuro.
...
kakuro_wikipedia: 9 guesses.
2017-03-04 08:57:52 +11:00
David Wang
dfda5961ef
Add test: Sujiko.
...
sujiko_simetric: 4 guesses.
Note that the puzzle on Wikipedia does not specify the initial board
configuration and is not unique.
2017-03-04 08:16:33 +11:00
David Wang
d9f92e2baa
Add test: Hidato.
...
hidato_wikipedia: 4 guesses.
2017-03-04 08:03:00 +11:00
David Wang
abb4cebce3
Equality: bound variable range by using min/max of other variables.
...
magicsquare_3x3: 873 -> 63 guesses.
magicsquare_4x4: 13475456 -> 539910 guesses (all solutions).
sendmoremoney_carry: 154 -> 6 guesses.
sendmoremoney_naive: 633681 -> 4 guesses.
zebra: 453 -> no guesswork!
2017-03-03 08:06:48 +11:00
David Wang
8e62c85bf5
Add test: Zebra puzzle (A.K.A. Einstein's riddle).
...
zebra: 453 guesses.
2017-03-02 08:42:46 +11:00
David Wang
57df25eb37
Add test: Magic Square.
...
magicsquare_3x3: 873 guesses.
magicsquare_4x4: 13475456 guesses (all solutions).
2017-03-02 08:25:29 +11:00
David Wang
67b7cb5dc6
Add test: Send More Money.
...
sendmoremoney_carry: 154 guesses.
sendmoremoney_naive: 633681 guesses.
2017-03-02 08:15:55 +11:00
David Wang
0477a5bbb0
Only wake affected constraints.
2017-02-25 08:17:07 +11:00
David Wang
6eb25f6af0
Add test: N-queens problem.
...
queens_4x4: 8 guesses.
queens_5x5: 21 guesses.
queens_6x6: 66 guesses.
queens_7x7: 179 guesses.
queens_8x8: 662 guesses.
2017-02-24 07:40:33 +11:00
David Wang
34e58114ea
Add test: Sudoku.
...
sudoku_hardest: 1850 guesses.
sudoku_wikipedia: no guesswork!
2017-02-24 07:26:56 +11:00