z3 0.0.0 → 0.0.20160221
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/bridges_solver +132 -0
- data/examples/kakuro_solver +124 -0
- data/examples/letter_connections_solver +199 -0
- data/lib/z3/ast.rb +1 -1
- data/lib/z3/low_level.rb +2 -183
- data/lib/z3/low_level_auto.rb +2063 -0
- data/lib/z3/very_low_level.rb +32 -64
- data/lib/z3/very_low_level_auto.rb +516 -0
- data/spec/integration/bridges_spec.rb +28 -0
- data/spec/integration/geometry_problem_spec.rb +1 -1
- data/spec/integration/kakuro_spec.rb +17 -0
- data/spec/integration/letter_connections_spec.rb +17 -0
- data/spec/integration/selfref_spec.rb +1 -1
- metadata +25 -3
@@ -0,0 +1,28 @@
|
|
1
|
+
describe "Bridges" do
|
2
|
+
let(:executable) { "#{__dir__}/../../examples/bridges_solver" }
|
3
|
+
it "can solve bridges puzzle" do
|
4
|
+
expect(IO.popen(executable).read.gsub(/ *$/, "")).to eq <<EOF
|
5
|
+
|
6
|
+
3========6========4
|
7
|
+
| ‖ ‖
|
8
|
+
| ‖ ‖
|
9
|
+
| 1 ‖ ‖
|
10
|
+
| | ‖ ‖
|
11
|
+
| | ‖ ‖
|
12
|
+
| | 4=====4 ‖
|
13
|
+
| | ‖ ‖
|
14
|
+
| | ‖ ‖
|
15
|
+
| | ‖ ‖
|
16
|
+
| | ‖ ‖
|
17
|
+
| | ‖ ‖
|
18
|
+
| | 1-----3 ‖ ‖
|
19
|
+
| | ‖ ‖ ‖
|
20
|
+
| | ‖ ‖ ‖
|
21
|
+
1 | ‖ 2 ‖
|
22
|
+
| ‖ ‖
|
23
|
+
| ‖ ‖
|
24
|
+
3========5-----3
|
25
|
+
|
26
|
+
EOF
|
27
|
+
end
|
28
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
describe "Geometry Problem" do
|
2
2
|
let(:executable) { "#{__dir__}/../../examples/geometry_problem" }
|
3
|
-
it "can solve
|
3
|
+
it "can solve geometry problem" do
|
4
4
|
expect(IO.popen(executable).read).to eq <<EOF
|
5
5
|
* a.x = 0.0
|
6
6
|
* a.y = (root-obj (+ (^ x 2) (- 300)) 1)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
describe "Kakuro" do
|
2
|
+
let(:executable) { "#{__dir__}/../../examples/kakuro_solver" }
|
3
|
+
it "can solve kakuro puzzle" do
|
4
|
+
expect(IO.popen(executable).read.gsub(/ *$/, "")).to eq <<EOF
|
5
|
+
x x x 10/ 24/ 29/ x 11/ 21/ 10/
|
6
|
+
x 11/ 19/24 [8] [9] [7] /6 [2] [3] [1]
|
7
|
+
/31 [8] [9] [2] [7] [5] 10/20 [9] [8] [3]
|
8
|
+
/4 [1] [3] 22/18 [8] [9] [1] 23/13 [9] [4]
|
9
|
+
/18 [2] [7] [9] 24/26 [8] [6] [9] [1] [2]
|
10
|
+
x 19/ 30/16 [7] [9] 10/11 [3] [8] 11/ 20/
|
11
|
+
/34 [9] [8] [6] [7] [4] 23/23 [6] [8] [9]
|
12
|
+
/7 [1] [6] 9/16 [8] [2] [6] 3/4 [1] [3]
|
13
|
+
/24 [7] [9] [8] /23 [3] [9] [1] [2] [8]
|
14
|
+
/10 [2] [7] [1] /11 [1] [8] [2] x x
|
15
|
+
EOF
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
describe "Letter Connections" do
|
2
|
+
let(:executable) { "#{__dir__}/../../examples/letter_connections_solver" }
|
3
|
+
it "can solve letter connections puzzle" do
|
4
|
+
expect(IO.popen(executable).read.gsub(/ *$/, "")).to eq <<EOF
|
5
|
+
→k →k *K *J →f →f →f →f *F *E
|
6
|
+
↑k ↓F →J ↑j ↑f →e →e →e →e ↑e
|
7
|
+
↑k →f →f →f ↑f ↑e *G ←g ←g ←g
|
8
|
+
↑k ←K →i *I →e ↑e →b →b ↓b ↑g
|
9
|
+
→i →i ↑i →e ↑e →b ↑b ↓D ↓b ↑g
|
10
|
+
↑I →E →e ↑e →b ↑b ↓d ←d *B ↑g
|
11
|
+
↓h ←h ←h ←H ↑b ↓d ←d *C *D ↑g
|
12
|
+
↓h →a →a *A ↑b ↓d →C ↑c ↑d ↑g
|
13
|
+
↓h ↑A →h *H ↑b →d →d →d ↑d ↑g
|
14
|
+
→h →h ↑h →B ↑b →G →g →g →g ↑g
|
15
|
+
EOF
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: z3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20160221
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Wegrzanowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
12
|
-
dependencies:
|
11
|
+
date: 2016-02-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ffi
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description: Ruby bindings for Z3 Constraint Solver
|
14
28
|
email: Tomasz.Wegrzanowski@gmail.com
|
15
29
|
executables: []
|
@@ -20,8 +34,11 @@ files:
|
|
20
34
|
- examples/algebra_problems
|
21
35
|
- examples/basic_int_math
|
22
36
|
- examples/basic_logic
|
37
|
+
- examples/bridges_solver
|
23
38
|
- examples/geometry_problem
|
39
|
+
- examples/kakuro_solver
|
24
40
|
- examples/kinematics_problems
|
41
|
+
- examples/letter_connections_solver
|
25
42
|
- examples/light_up_solver
|
26
43
|
- examples/minisudoku_solver
|
27
44
|
- examples/selfref_solver
|
@@ -32,16 +49,21 @@ files:
|
|
32
49
|
- lib/z3/context.rb
|
33
50
|
- lib/z3/func_decl.rb
|
34
51
|
- lib/z3/low_level.rb
|
52
|
+
- lib/z3/low_level_auto.rb
|
35
53
|
- lib/z3/model.rb
|
36
54
|
- lib/z3/solver.rb
|
37
55
|
- lib/z3/sort.rb
|
38
56
|
- lib/z3/very_low_level.rb
|
57
|
+
- lib/z3/very_low_level_auto.rb
|
39
58
|
- spec/ast_spec.rb
|
40
59
|
- spec/integration/algebra_problems_spec.rb
|
41
60
|
- spec/integration/bagic_int_math_spec.rb
|
42
61
|
- spec/integration/basic_logic_spec.rb
|
62
|
+
- spec/integration/bridges_spec.rb
|
43
63
|
- spec/integration/geometry_problem_spec.rb
|
64
|
+
- spec/integration/kakuro_spec.rb
|
44
65
|
- spec/integration/kinematics_problems_spec.rb
|
66
|
+
- spec/integration/letter_connections_spec.rb
|
45
67
|
- spec/integration/light_up_spec.rb
|
46
68
|
- spec/integration/minisudoku_spec.rb
|
47
69
|
- spec/integration/selfref_spec.rb
|