rubywarrior 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +11 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +36 -0
- data/Rakefile +4 -9
- data/features/step_definitions/interaction_steps.rb +5 -5
- data/features/support/env.rb +1 -1
- data/lib/ruby_warrior/game.rb +1 -1
- data/lib/ruby_warrior/level.rb +5 -1
- data/lib/ruby_warrior/player_generator.rb +2 -2
- data/lib/ruby_warrior/profile.rb +1 -1
- data/lib/ruby_warrior/tower.rb +1 -1
- data/spec/ruby_warrior/abilities/attack_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/base_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/bind_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/direction_of_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/direction_of_stairs_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/distance_of_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/explode_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/feel_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/form_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/health_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/listen_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/look_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/pivot_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/rescue_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/rest_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/shoot_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/throw_spec.rb +1 -1
- data/spec/ruby_warrior/abilities/walk_spec.rb +1 -1
- data/spec/ruby_warrior/core_additions_spec.rb +1 -1
- data/spec/ruby_warrior/floor_spec.rb +1 -1
- data/spec/ruby_warrior/game_spec.rb +2 -2
- data/spec/ruby_warrior/level_loader_spec.rb +1 -1
- data/spec/ruby_warrior/level_spec.rb +2 -2
- data/spec/ruby_warrior/player_generator_spec.rb +2 -2
- data/spec/ruby_warrior/position_spec.rb +1 -1
- data/spec/ruby_warrior/profile_spec.rb +2 -2
- data/spec/ruby_warrior/space_spec.rb +1 -1
- data/spec/ruby_warrior/tower_spec.rb +1 -1
- data/spec/ruby_warrior/turn_spec.rb +1 -1
- data/spec/ruby_warrior/ui_spec.rb +1 -1
- data/spec/ruby_warrior/units/archer_spec.rb +1 -1
- data/spec/ruby_warrior/units/base_spec.rb +1 -1
- data/spec/ruby_warrior/units/captive_spec.rb +1 -1
- data/spec/ruby_warrior/units/golem_spec.rb +1 -1
- data/spec/ruby_warrior/units/sludge_spec.rb +1 -1
- data/spec/ruby_warrior/units/thick_sludge_spec.rb +1 -1
- data/spec/ruby_warrior/units/warrior_spec.rb +1 -1
- data/spec/ruby_warrior/units/wizard_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- data/towers/beginner/level_002.rb +1 -1
- data/towers/beginner/level_003.rb +1 -1
- data/towers/beginner/level_005.rb +2 -2
- data/towers/beginner/level_006.rb +2 -2
- data/towers/intermediate/level_002.rb +1 -1
- data/towers/intermediate/level_003.rb +2 -2
- metadata +25 -44
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
0.1.3 (April 28, 2012)
|
2
|
+
|
3
|
+
* Making specs pass with latest RSpec.
|
4
|
+
|
5
|
+
* Lowering ace score for Beginner Level 6.
|
6
|
+
|
7
|
+
* Store relative tower paths in Profile so files can be moved.
|
8
|
+
|
9
|
+
* Other minor bug fixes (see commit history for details)
|
10
|
+
|
11
|
+
|
1
12
|
0.1.2 (September 23, 2010)
|
2
13
|
|
3
14
|
* Adding intermediate level 9 with distance_of ability
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
builder (3.0.0)
|
5
|
+
cucumber (1.1.9)
|
6
|
+
builder (>= 2.1.2)
|
7
|
+
diff-lcs (>= 1.1.2)
|
8
|
+
gherkin (~> 2.9.0)
|
9
|
+
json (>= 1.4.6)
|
10
|
+
term-ansicolor (>= 1.0.6)
|
11
|
+
diff-lcs (1.1.3)
|
12
|
+
gherkin (2.9.3)
|
13
|
+
json (>= 1.4.6)
|
14
|
+
json (1.7.0)
|
15
|
+
metaclass (0.0.1)
|
16
|
+
mocha (0.11.3)
|
17
|
+
metaclass (~> 0.0.1)
|
18
|
+
rake (0.9.2.2)
|
19
|
+
rspec (2.8.0)
|
20
|
+
rspec-core (~> 2.8.0)
|
21
|
+
rspec-expectations (~> 2.8.0)
|
22
|
+
rspec-mocks (~> 2.8.0)
|
23
|
+
rspec-core (2.8.0)
|
24
|
+
rspec-expectations (2.8.0)
|
25
|
+
diff-lcs (~> 1.1.2)
|
26
|
+
rspec-mocks (2.8.0)
|
27
|
+
term-ansicolor (1.0.7)
|
28
|
+
|
29
|
+
PLATFORMS
|
30
|
+
ruby
|
31
|
+
|
32
|
+
DEPENDENCIES
|
33
|
+
cucumber
|
34
|
+
mocha
|
35
|
+
rake
|
36
|
+
rspec (~> 2.8.0)
|
data/Rakefile
CHANGED
@@ -1,17 +1,12 @@
|
|
1
1
|
require 'rake'
|
2
|
-
require '
|
2
|
+
require 'rspec'
|
3
|
+
require 'rspec/core/rake_task'
|
3
4
|
require 'cucumber'
|
4
|
-
|
5
5
|
require 'cucumber/rake/task'
|
6
|
-
require 'spec/rake/spectask'
|
7
|
-
|
8
|
-
|
9
|
-
spec_files = Rake::FileList["spec/**/*_spec.rb"]
|
10
6
|
|
11
7
|
desc "Run specs"
|
12
|
-
|
13
|
-
t.
|
14
|
-
t.spec_opts = ["-c"]
|
8
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
9
|
+
t.pattern = "spec/**/*_spec.rb"
|
15
10
|
end
|
16
11
|
|
17
12
|
Cucumber::Rake::Task.new(:features) do |t|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
Given /^a profile named "([^\"]*)" on "([^\"]*)"$/ do |name, tower|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
step 'I run rubywarrior'
|
3
|
+
step 'I answer "y" to "create one?"'
|
4
|
+
step 'I choose "' + tower + '" for "tower"'
|
5
|
+
step 'I answer "' + name + '" to "name"'
|
6
|
+
step 'I should see "generated"'
|
7
7
|
end
|
8
8
|
|
9
9
|
Given /^no profile at "([^\"]*)"$/ do |path|
|
data/features/support/env.rb
CHANGED
data/lib/ruby_warrior/game.rb
CHANGED
data/lib/ruby_warrior/level.rb
CHANGED
@@ -24,7 +24,11 @@ module RubyWarrior
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def load_path
|
27
|
-
|
27
|
+
File.join(
|
28
|
+
File.expand_path('../../../towers/', __FILE__),
|
29
|
+
File.basename(@profile.tower_path) + "/level_" +
|
30
|
+
@number.to_s.rjust(3, '0') + ".rb"
|
31
|
+
)
|
28
32
|
end
|
29
33
|
|
30
34
|
def load_level
|
@@ -19,7 +19,7 @@ module RubyWarrior
|
|
19
19
|
# TODO refactor and test this method
|
20
20
|
def generate
|
21
21
|
if level.number == 1
|
22
|
-
FileUtils.mkdir_p(level.player_path)
|
22
|
+
FileUtils.mkdir_p(level.player_path) unless File.exists? level.player_path
|
23
23
|
FileUtils.cp(templates_path + '/player.rb', level.player_path)
|
24
24
|
end
|
25
25
|
|
@@ -29,7 +29,7 @@ module RubyWarrior
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def templates_path
|
32
|
-
File.expand_path(
|
32
|
+
File.expand_path("../../../templates", __FILE__)
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
data/lib/ruby_warrior/profile.rb
CHANGED
data/lib/ruby_warrior/tower.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe RubyWarrior::Game do
|
4
4
|
before(:each) do
|
@@ -74,7 +74,7 @@ describe RubyWarrior::Game do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it "should find tower paths using Dir[] search" do
|
77
|
-
Dir.expects(:[]).with(File.expand_path(
|
77
|
+
Dir.expects(:[]).with(File.expand_path('../../../towers/*', __FILE__))
|
78
78
|
@game.tower_paths
|
79
79
|
end
|
80
80
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'set'
|
3
3
|
|
4
4
|
describe RubyWarrior::Level do
|
@@ -51,7 +51,7 @@ describe RubyWarrior::Level do
|
|
51
51
|
|
52
52
|
it "should have a load path from profile tower with level number in it" do
|
53
53
|
@profile.stubs(:tower_path).returns('path/to/tower')
|
54
|
-
@level.load_path.should == '
|
54
|
+
@level.load_path.should == File.expand_path('towers/tower/level_001.rb')
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should exist if file exists" do
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe RubyWarrior::PlayerGenerator do
|
4
4
|
before(:each) do
|
@@ -7,6 +7,6 @@ describe RubyWarrior::PlayerGenerator do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should know templates path" do
|
10
|
-
@generator.templates_path.should == File.expand_path(
|
10
|
+
@generator.templates_path.should == File.expand_path("../../../templates", __FILE__)
|
11
11
|
end
|
12
12
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe RubyWarrior::Profile do
|
4
4
|
before(:each) do
|
@@ -164,7 +164,7 @@ describe RubyWarrior::Profile do
|
|
164
164
|
end
|
165
165
|
|
166
166
|
it "should load tower from path" do
|
167
|
-
RubyWarrior::Tower.expects(:new).with('
|
167
|
+
RubyWarrior::Tower.expects(:new).with('tower').returns('tower')
|
168
168
|
@profile.tower.should == 'tower'
|
169
169
|
end
|
170
170
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# --------
|
4
4
|
|
5
5
|
description "It is too dark to see anything, but you smell sludge nearby."
|
6
|
-
tip "Use warrior.feel.empty? to see if there
|
6
|
+
tip "Use warrior.feel.empty? to see if there is anything in front of you, and warrior.attack! to fight it. Remember, you can only do one action (ending in !) per turn."
|
7
7
|
clue "Add an if/else condition using warrior.feel.empty? to decide whether to warrior.attack! or warrior.walk!."
|
8
8
|
|
9
9
|
time_bonus 20
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
description "The air feels thicker than before. There must be a horde of sludge."
|
6
6
|
tip "Be careful not to die! Use warrior.health to keep an eye on your health, and warrior.rest! to earn 10% of max health back."
|
7
|
-
clue "When there
|
7
|
+
clue "When there is no enemy ahead of you call warrior.rest! until health is full before walking forward."
|
8
8
|
|
9
9
|
time_bonus 35
|
10
10
|
ace_score 71
|
@@ -3,8 +3,8 @@
|
|
3
3
|
# -------
|
4
4
|
|
5
5
|
description "You hear cries for help. Captives must need rescuing."
|
6
|
-
tip "Use warrior.feel.captive? to see if there
|
7
|
-
clue "Don't forget to constantly check if you're taking damage
|
6
|
+
tip "Use warrior.feel.captive? to see if there is a captive and warrior.rescue! to rescue him. Don't attack captives."
|
7
|
+
clue "Don't forget to constantly check if you're taking damage. Rest until your health is full if you aren't taking damage."
|
8
8
|
|
9
9
|
time_bonus 45
|
10
10
|
ace_score 123
|
@@ -3,11 +3,11 @@
|
|
3
3
|
# --------
|
4
4
|
|
5
5
|
description "The wall behind you feels a bit further away in this room. And you hear more cries for help."
|
6
|
-
tip "You can walk backward by passing ':backward' as an argument to walk!. Same goes for feel, rescue! and attack!."
|
6
|
+
tip "You can walk backward by passing ':backward' as an argument to walk!. Same goes for feel, rescue! and attack!. Archers have a limited attack distance."
|
7
7
|
clue "Walk backward if you are taking damage from afar and do not have enough health to attack. You may also want to consider walking backward until warrior.feel(:backward).wall?."
|
8
8
|
|
9
9
|
time_bonus 55
|
10
|
-
ace_score
|
10
|
+
ace_score 105
|
11
11
|
size 8, 1
|
12
12
|
stairs 7, 0
|
13
13
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
description "Another large room, but with several enemies blocking your way to the stairs."
|
7
7
|
tip "Just like walking, you can attack! and feel in multiple directions (:forward, :left, :right, :backward)."
|
8
|
-
clue "Call warrior.feel(direction).enemy? in each direction to make sure there isn't an enemy beside you (attack if there is). Call warrior.rest! if you're low and health when there
|
8
|
+
clue "Call warrior.feel(direction).enemy? in each direction to make sure there isn't an enemy beside you (attack if there is). Call warrior.rest! if you're low and health when there are no enemies around."
|
9
9
|
|
10
10
|
time_bonus 40
|
11
11
|
ace_score 84
|
@@ -5,8 +5,8 @@
|
|
5
5
|
# ---
|
6
6
|
|
7
7
|
description "You feel slime on all sides, you're surrounded!"
|
8
|
-
tip "Call warrior.bind!(direction) to bind an enemy to keep him from attacking. Bound enemies look like
|
9
|
-
clue "Count the number of enemies around you
|
8
|
+
tip "Call warrior.bind!(direction) to bind an enemy to keep him from attacking. Bound enemies look like captives."
|
9
|
+
clue "Count the number of enemies around you. Bind an enemy if there are two or more."
|
10
10
|
|
11
11
|
time_bonus 50
|
12
12
|
ace_score 101
|
metadata
CHANGED
@@ -1,33 +1,25 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubywarrior
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 2
|
10
|
-
version: 0.1.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Ryan Bates
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2010-09-23 00:00:00 -07:00
|
19
|
-
default_executable:
|
12
|
+
date: 2012-04-28 00:00:00.000000000Z
|
20
13
|
dependencies: []
|
21
|
-
|
22
|
-
|
14
|
+
description: You play as a warrior climbing a tall tower. On each floor you need to
|
15
|
+
write a Ruby script to instruct the warrior to battle enemies, rescue captives,
|
16
|
+
and reach the stairs.
|
23
17
|
email: ryan@railscasts.com
|
24
|
-
executables:
|
18
|
+
executables:
|
25
19
|
- rubywarrior
|
26
20
|
extensions: []
|
27
|
-
|
28
21
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
22
|
+
files:
|
31
23
|
- lib/ruby_warrior/abilities/attack.rb
|
32
24
|
- lib/ruby_warrior/abilities/base.rb
|
33
25
|
- lib/ruby_warrior/abilities/bind.rb
|
@@ -141,44 +133,33 @@ files:
|
|
141
133
|
- templates/README.erb
|
142
134
|
- bin/rubywarrior
|
143
135
|
- CHANGELOG.rdoc
|
136
|
+
- Gemfile
|
137
|
+
- Gemfile.lock
|
144
138
|
- LICENSE
|
145
139
|
- Rakefile
|
146
140
|
- README.rdoc
|
147
|
-
|
148
|
-
homepage: http://github.com/ryanb/ruby-warrior
|
141
|
+
homepage: https://github.com/ryanb/ruby-warrior
|
149
142
|
licenses: []
|
150
|
-
|
151
143
|
post_install_message:
|
152
144
|
rdoc_options: []
|
153
|
-
|
154
|
-
require_paths:
|
145
|
+
require_paths:
|
155
146
|
- lib
|
156
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
157
148
|
none: false
|
158
|
-
requirements:
|
159
|
-
- -
|
160
|
-
- !ruby/object:Gem::Version
|
161
|
-
|
162
|
-
|
163
|
-
- 0
|
164
|
-
version: "0"
|
165
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ! '>='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
154
|
none: false
|
167
|
-
requirements:
|
168
|
-
- -
|
169
|
-
- !ruby/object:Gem::Version
|
170
|
-
hash: 19
|
171
|
-
segments:
|
172
|
-
- 1
|
173
|
-
- 3
|
174
|
-
- 4
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
175
158
|
version: 1.3.4
|
176
159
|
requirements: []
|
177
|
-
|
178
160
|
rubyforge_project: rubywarrior
|
179
|
-
rubygems_version: 1.
|
161
|
+
rubygems_version: 1.8.10
|
180
162
|
signing_key:
|
181
163
|
specification_version: 3
|
182
164
|
summary: Game written in Ruby for learning Ruby and artificial intelligence.
|
183
165
|
test_files: []
|
184
|
-
|