sokoban 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/sokoban/version.rb +1 -1
- data/spec/lib/sokoban_spec.rb +51 -3
- metadata +18 -11
- checksums.yaml +0 -7
data/Gemfile.lock
CHANGED
data/lib/sokoban/version.rb
CHANGED
data/spec/lib/sokoban_spec.rb
CHANGED
@@ -55,6 +55,7 @@ describe Level do
|
|
55
55
|
it "restarts" do
|
56
56
|
level = Level.new
|
57
57
|
input_moves(level)
|
58
|
+
expect(level.free_boxes).to eq(1)
|
58
59
|
level.parse_move('r') # restart
|
59
60
|
expect(level.free_boxes).to eq(6)
|
60
61
|
end
|
@@ -62,7 +63,7 @@ describe Level do
|
|
62
63
|
it "plays level 1" do
|
63
64
|
level = Level.new
|
64
65
|
input_moves(level)
|
65
|
-
level.parse_move('d') #
|
66
|
+
level.parse_move('d') # right
|
66
67
|
expect(level.free_boxes).to eq(0) # Victory!
|
67
68
|
end
|
68
69
|
|
@@ -70,16 +71,63 @@ describe Level do
|
|
70
71
|
level = Level.new
|
71
72
|
input_moves(level)
|
72
73
|
expect(level.pushes).to eq(96)
|
73
|
-
level.parse_move('d') #
|
74
|
+
level.parse_move('d') # right
|
74
75
|
expect(level.pushes).to eq(97)
|
75
76
|
end
|
76
77
|
|
77
78
|
it "decrements pushes on box move undo" do
|
78
79
|
level = Level.new
|
79
80
|
input_moves(level)
|
80
|
-
level.parse_move('d') #
|
81
|
+
level.parse_move('d') # right
|
81
82
|
expect(level.pushes).to eq(97)
|
82
83
|
level.parse_move('u') # undo
|
83
84
|
expect(level.pushes).to eq(96)
|
84
85
|
end
|
86
|
+
|
87
|
+
it "ignores moves into walls" do
|
88
|
+
level = Level.new
|
89
|
+
input_moves(level)
|
90
|
+
level.parse_move('a') # left
|
91
|
+
expect(level.moves).to eq(INPUT.size + 1)
|
92
|
+
# Try to move into wall
|
93
|
+
level.parse_move('w') # up
|
94
|
+
expect(level.moves).to eq(INPUT.size + 1)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "ignores moves into non-free boxes" do
|
98
|
+
level = Level.new
|
99
|
+
input_moves(level)
|
100
|
+
level.parse_move('s') # down
|
101
|
+
level.parse_move('d') # right
|
102
|
+
expect(level.moves).to eq(INPUT.size + 2)
|
103
|
+
# Try to move into non-free box
|
104
|
+
level.parse_move('d') # right
|
105
|
+
expect(level.moves).to eq(INPUT.size + 2)
|
106
|
+
end
|
107
|
+
|
108
|
+
it "ignores pushes into walls" do
|
109
|
+
level = Level.new
|
110
|
+
input_moves(level)
|
111
|
+
level.parse_move('s') # down
|
112
|
+
level.parse_move('d') # right
|
113
|
+
level.parse_move('w') # up
|
114
|
+
expect(level.pushes).to eq(97)
|
115
|
+
# Try to push box into wall
|
116
|
+
level.parse_move('w') # up
|
117
|
+
expect(level.pushes).to eq(97)
|
118
|
+
end
|
119
|
+
|
120
|
+
it "ignores pushes into non-free boxes" do
|
121
|
+
level = Level.new
|
122
|
+
input_moves(level)
|
123
|
+
level.parse_move('w') # up
|
124
|
+
level.parse_move('d') # right
|
125
|
+
level.parse_move('s') # down
|
126
|
+
expect(level.pushes).to eq(97)
|
127
|
+
level.parse_move('a') # left
|
128
|
+
level.parse_move('s') # down
|
129
|
+
# Try to push box into non-free box
|
130
|
+
level.parse_move('d') # right
|
131
|
+
expect(level.pushes).to eq(97)
|
132
|
+
end
|
85
133
|
end
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sokoban
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Boohbah
|
@@ -13,34 +14,39 @@ dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rake
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- - '>='
|
19
|
+
- - ! '>='
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0'
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- - '>='
|
27
|
+
- - ! '>='
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0'
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rspec
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: bundler
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -76,29 +83,29 @@ files:
|
|
76
83
|
homepage: http://rubygems.org/gems/sokoban
|
77
84
|
licenses:
|
78
85
|
- GPL
|
79
|
-
metadata: {}
|
80
86
|
post_install_message:
|
81
87
|
rdoc_options: []
|
82
88
|
require_paths:
|
83
89
|
- lib
|
84
90
|
- bin
|
85
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
86
93
|
requirements:
|
87
|
-
- - '>='
|
94
|
+
- - ! '>='
|
88
95
|
- !ruby/object:Gem::Version
|
89
96
|
version: '0'
|
90
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
91
99
|
requirements:
|
92
|
-
- - '>='
|
100
|
+
- - ! '>='
|
93
101
|
- !ruby/object:Gem::Version
|
94
102
|
version: '0'
|
95
103
|
requirements: []
|
96
104
|
rubyforge_project:
|
97
|
-
rubygems_version:
|
105
|
+
rubygems_version: 1.8.23
|
98
106
|
signing_key:
|
99
|
-
specification_version:
|
107
|
+
specification_version: 3
|
100
108
|
summary: A classic warehouse puzzle game
|
101
109
|
test_files:
|
102
110
|
- spec/lib/sokoban_spec.rb
|
103
111
|
- spec/spec_helper.rb
|
104
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 589a162f779a7a0c824b766c4238d681b9895b6f
|
4
|
-
data.tar.gz: f391280ce7a29fc65dfc013c9105328e007835ee
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 760e2cc272f589f563ba266415fda7093fc23c19f8332209b5ec0086058bd1432b5ba42f396a919389189b2a74bd46a08d490c5e1a2dada21fd56df8fff844fe
|
7
|
-
data.tar.gz: 700b9c9f2cfaee7d3a1e48ca5f4aaa5029b62052820f0608129f53749a6b287b2dc2d1170a7309a166ef153336e0e0e72c7b3258d22881de7101c158882636f0
|