Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: ryanb/ruby-warrior
base: c80d4e2a6e
...
head fork: ryanb/ruby-warrior
compare: 03a9e73a7a
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 17 files changed
  • 0 commit comments
  • 1 contributor
View
1  .rspec
@@ -0,0 +1 @@
+--color
View
11 CHANGELOG.rdoc
@@ -1,3 +1,14 @@
+0.1.3 (April 28, 2012)
+
+* Making specs pass with latest RSpec.
+
+* Lowering ace score for Beginner Level 6.
+
+* Store relative tower paths in Profile so files can be moved.
+
+* Other minor bug fixes (see commit history for details)
+
+
0.1.2 (September 23, 2010)
* Adding intermediate level 9 with distance_of ability
View
2  lib/ruby_warrior/game.rb
@@ -156,7 +156,7 @@ def towers
end
def tower_paths
- Dir[File.expand_path(File.dirname(__FILE__) + '/../../towers/*')]
+ Dir[File.expand_path('../../../towers/*', __FILE__)]
end
View
2  lib/ruby_warrior/level.rb
@@ -25,7 +25,7 @@ def player_path
def load_path
File.join(
- File.expand_path(File.dirname(__FILE__) + '/../../towers/'),
+ File.expand_path('../../../towers/', __FILE__),
File.basename(@profile.tower_path) + "/level_" +
@number.to_s.rjust(3, '0') + ".rb"
)
View
2  lib/ruby_warrior/player_generator.rb
@@ -29,7 +29,7 @@ def generate
end
def templates_path
- File.expand_path(File.dirname(__FILE__) + "/../../templates")
+ File.expand_path("../../../templates", __FILE__)
end
private
View
2  lib/ruby_warrior/tower.rb
@@ -3,7 +3,7 @@ class Tower
attr_reader :path
def initialize(path)
- @path = File.join(File.expand_path(File.dirname(__FILE__) + '/../../towers/'), path)
+ @path = File.join(File.expand_path('../../../towers/', __FILE__), path)
end
def name
View
4 rubywarrior.gemspec
@@ -1,9 +1,9 @@
Gem::Specification.new do |s|
s.name = "rubywarrior"
- s.version = "0.1.2"
+ s.version = "0.1.3"
s.author = "Ryan Bates"
s.email = "ryan@railscasts.com"
- s.homepage = "http://github.com/ryanb/ruby-warrior"
+ s.homepage = "https://github.com/ryanb/ruby-warrior"
s.summary = "Game written in Ruby for learning Ruby and artificial intelligence."
s.description = "You play as a warrior climbing a tall tower. On each floor you need to write a Ruby script to instruct the warrior to battle enemies, rescue captives, and reach the stairs."
View
2  spec/ruby_warrior/game_spec.rb
@@ -74,7 +74,7 @@
end
it "should find tower paths using Dir[] search" do
- Dir.expects(:[]).with(File.expand_path(File.dirname(__FILE__) + '/../../towers/*'))
+ Dir.expects(:[]).with(File.expand_path('../../../towers/*', __FILE__))
@game.tower_paths
end
View
2  spec/ruby_warrior/level_spec.rb
@@ -51,7 +51,7 @@
it "should have a load path from profile tower with level number in it" do
@profile.stubs(:tower_path).returns('path/to/tower')
- @level.load_path.should == 'path/to/tower/level_001.rb'
+ @level.load_path.should == File.expand_path('towers/tower/level_001.rb')
end
it "should exist if file exists" do
View
2  spec/ruby_warrior/player_generator_spec.rb
@@ -7,6 +7,6 @@
end
it "should know templates path" do
- @generator.templates_path.should == File.expand_path(File.dirname(__FILE__) + "/../../templates")
+ @generator.templates_path.should == File.expand_path("../../../templates", __FILE__)
end
end
View
2  spec/ruby_warrior/profile_spec.rb
@@ -164,7 +164,7 @@
end
it "should load tower from path" do
- RubyWarrior::Tower.expects(:new).with('path/to/tower').returns('tower')
+ RubyWarrior::Tower.expects(:new).with('tower').returns('tower')
@profile.tower.should == 'tower'
end
end
View
2  towers/beginner/level_002.rb
@@ -3,7 +3,7 @@
# --------
description "It is too dark to see anything, but you smell sludge nearby."
-tip "Use warrior.feel.empty? to see if there's anything in front of you, and warrior.attack! to fight it. Remember, you can only do one action (ending in !) per turn."
+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."
clue "Add an if/else condition using warrior.feel.empty? to decide whether to warrior.attack! or warrior.walk!."
time_bonus 20
View
2  towers/beginner/level_003.rb
@@ -4,7 +4,7 @@
description "The air feels thicker than before. There must be a horde of sludge."
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."
-clue "When there's no enemy ahead of you, call warrior.rest! until health is full before walking forward."
+clue "When there is no enemy ahead of you call warrior.rest! until health is full before walking forward."
time_bonus 35
ace_score 71
View
4 towers/beginner/level_005.rb
@@ -3,8 +3,8 @@
# -------
description "You hear cries for help. Captives must need rescuing."
-tip "Use warrior.feel.captive? to see if there's a captive, and warrior.rescue! to rescue him. Don't attack captives."
-clue "Don't forget to constantly check if you're taking damage and rest until your health is full if you aren't taking damage."
+tip "Use warrior.feel.captive? to see if there is a captive and warrior.rescue! to rescue him. Don't attack captives."
+clue "Don't forget to constantly check if you're taking damage. Rest until your health is full if you aren't taking damage."
time_bonus 45
ace_score 123
View
2  towers/beginner/level_006.rb
@@ -3,7 +3,7 @@
# --------
description "The wall behind you feels a bit further away in this room. And you hear more cries for help."
-tip "You can walk backward by passing ':backward' as an argument to walk!. Same goes for feel, rescue! and attack!."
+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."
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?."
time_bonus 55
View
2  towers/intermediate/level_002.rb
@@ -5,7 +5,7 @@
description "Another large room, but with several enemies blocking your way to the stairs."
tip "Just like walking, you can attack! and feel in multiple directions (:forward, :left, :right, :backward)."
-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's no enemies around."
+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."
time_bonus 40
ace_score 84
View
2  towers/intermediate/level_003.rb
@@ -6,7 +6,7 @@
description "You feel slime on all sides, you're surrounded!"
tip "Call warrior.bind!(direction) to bind an enemy to keep him from attacking. Bound enemies look like captives."
-clue "Count the number of enemies around you, if there's two or more, bind one."
+clue "Count the number of enemies around you. Bind an enemy if there are two or more."
time_bonus 50
ace_score 101

No commit comments for this range

Something went wrong with that request. Please try again.