rubywarrior 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/CHANGELOG.rdoc +3 -0
  2. data/LICENSE +20 -0
  3. data/README.rdoc +170 -0
  4. data/Rakefile +21 -0
  5. data/bin/rubywarrior +5 -0
  6. data/features/command_options.feature +46 -0
  7. data/features/levels.feature +51 -0
  8. data/features/profiles.feature +56 -0
  9. data/features/step_definitions/common_steps.rb +19 -0
  10. data/features/step_definitions/interaction_steps.rb +65 -0
  11. data/features/support/env.rb +12 -0
  12. data/features/support/mockio.rb +57 -0
  13. data/features/towers.feature +14 -0
  14. data/lib/ruby_warrior.rb +44 -0
  15. data/lib/ruby_warrior/abilities/attack.rb +24 -0
  16. data/lib/ruby_warrior/abilities/base.rb +36 -0
  17. data/lib/ruby_warrior/abilities/bind.rb +19 -0
  18. data/lib/ruby_warrior/abilities/direction_of.rb +13 -0
  19. data/lib/ruby_warrior/abilities/direction_of_stairs.rb +13 -0
  20. data/lib/ruby_warrior/abilities/distance.rb +13 -0
  21. data/lib/ruby_warrior/abilities/explode.rb +16 -0
  22. data/lib/ruby_warrior/abilities/feel.rb +13 -0
  23. data/lib/ruby_warrior/abilities/health.rb +13 -0
  24. data/lib/ruby_warrior/abilities/listen.rb +15 -0
  25. data/lib/ruby_warrior/abilities/look.rb +15 -0
  26. data/lib/ruby_warrior/abilities/pivot.rb +16 -0
  27. data/lib/ruby_warrior/abilities/rescue.rb +23 -0
  28. data/lib/ruby_warrior/abilities/rest.rb +20 -0
  29. data/lib/ruby_warrior/abilities/shoot.rb +23 -0
  30. data/lib/ruby_warrior/abilities/walk.rb +20 -0
  31. data/lib/ruby_warrior/config.rb +22 -0
  32. data/lib/ruby_warrior/core_additions.rb +25 -0
  33. data/lib/ruby_warrior/floor.rb +71 -0
  34. data/lib/ruby_warrior/game.rb +193 -0
  35. data/lib/ruby_warrior/level.rb +119 -0
  36. data/lib/ruby_warrior/level_loader.rb +56 -0
  37. data/lib/ruby_warrior/player_generator.rb +41 -0
  38. data/lib/ruby_warrior/position.rb +80 -0
  39. data/lib/ruby_warrior/profile.rb +104 -0
  40. data/lib/ruby_warrior/runner.rb +33 -0
  41. data/lib/ruby_warrior/space.rb +63 -0
  42. data/lib/ruby_warrior/tower.rb +14 -0
  43. data/lib/ruby_warrior/turn.rb +38 -0
  44. data/lib/ruby_warrior/ui.rb +54 -0
  45. data/lib/ruby_warrior/units/archer.rb +34 -0
  46. data/lib/ruby_warrior/units/base.rb +95 -0
  47. data/lib/ruby_warrior/units/captive.rb +30 -0
  48. data/lib/ruby_warrior/units/sludge.rb +30 -0
  49. data/lib/ruby_warrior/units/thick_sludge.rb +13 -0
  50. data/lib/ruby_warrior/units/warrior.rb +58 -0
  51. data/lib/ruby_warrior/units/wizard.rb +34 -0
  52. data/spec/fixtures/short-tower/level_001.rb +15 -0
  53. data/spec/fixtures/short-tower/level_002.rb +15 -0
  54. data/spec/fixtures/walking_player.rb +5 -0
  55. data/spec/ruby_warrior/abilities/attack_spec.rb +51 -0
  56. data/spec/ruby_warrior/abilities/base_spec.rb +24 -0
  57. data/spec/ruby_warrior/abilities/bind_spec.rb +19 -0
  58. data/spec/ruby_warrior/abilities/direction_of_spec.rb +13 -0
  59. data/spec/ruby_warrior/abilities/direction_of_stairs_spec.rb +13 -0
  60. data/spec/ruby_warrior/abilities/distance_spec.rb +13 -0
  61. data/spec/ruby_warrior/abilities/explode_spec.rb +21 -0
  62. data/spec/ruby_warrior/abilities/feel_spec.rb +13 -0
  63. data/spec/ruby_warrior/abilities/health_spec.rb +13 -0
  64. data/spec/ruby_warrior/abilities/listen_spec.rb +17 -0
  65. data/spec/ruby_warrior/abilities/look_spec.rb +15 -0
  66. data/spec/ruby_warrior/abilities/pivot_spec.rb +18 -0
  67. data/spec/ruby_warrior/abilities/rescue_spec.rb +40 -0
  68. data/spec/ruby_warrior/abilities/rest_spec.rb +29 -0
  69. data/spec/ruby_warrior/abilities/shoot_spec.rb +22 -0
  70. data/spec/ruby_warrior/abilities/walk_spec.rb +25 -0
  71. data/spec/ruby_warrior/floor_spec.rb +81 -0
  72. data/spec/ruby_warrior/game_spec.rb +119 -0
  73. data/spec/ruby_warrior/level_loader_spec.rb +54 -0
  74. data/spec/ruby_warrior/level_spec.rb +203 -0
  75. data/spec/ruby_warrior/player_generator_spec.rb +12 -0
  76. data/spec/ruby_warrior/position_spec.rb +103 -0
  77. data/spec/ruby_warrior/profile_spec.rb +144 -0
  78. data/spec/ruby_warrior/space_spec.rb +165 -0
  79. data/spec/ruby_warrior/tower_spec.rb +15 -0
  80. data/spec/ruby_warrior/turn_spec.rb +42 -0
  81. data/spec/ruby_warrior/ui_spec.rb +93 -0
  82. data/spec/ruby_warrior/units/archer_spec.rb +23 -0
  83. data/spec/ruby_warrior/units/base_spec.rb +133 -0
  84. data/spec/ruby_warrior/units/captive_spec.rb +34 -0
  85. data/spec/ruby_warrior/units/sludge_spec.rb +27 -0
  86. data/spec/ruby_warrior/units/thick_sludge_spec.rb +19 -0
  87. data/spec/ruby_warrior/units/warrior_spec.rb +60 -0
  88. data/spec/ruby_warrior/units/wizard_spec.rb +23 -0
  89. data/spec/spec_helper.rb +10 -0
  90. data/templates/README.erb +20 -0
  91. data/templates/player.rb +5 -0
  92. data/towers/beginner/level_001.rb +16 -0
  93. data/towers/beginner/level_002.rb +18 -0
  94. data/towers/beginner/level_003.rb +21 -0
  95. data/towers/beginner/level_004.rb +18 -0
  96. data/towers/beginner/level_005.rb +22 -0
  97. data/towers/beginner/level_006.rb +19 -0
  98. data/towers/beginner/level_007.rb +18 -0
  99. data/towers/beginner/level_008.rb +21 -0
  100. data/towers/beginner/level_009.rb +20 -0
  101. data/towers/intermediate/level_001.rb +18 -0
  102. data/towers/intermediate/level_002.rb +20 -0
  103. data/towers/intermediate/level_003.rb +23 -0
  104. data/towers/intermediate/level_004.rb +24 -0
  105. data/towers/intermediate/level_005.rb +19 -0
  106. data/towers/intermediate/level_006.rb +24 -0
  107. metadata +167 -0
@@ -0,0 +1,23 @@
1
+ # ---
2
+ # |>s |
3
+ # |s@s|
4
+ # | C |
5
+ # ---
6
+
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 capitves."
9
+ clue "Count the number of enemies around you, if there's two or more, bind one."
10
+
11
+ time_bonus 50
12
+ ace_score 101
13
+ size 3, 3
14
+ stairs 0, 0
15
+
16
+ warrior 1, 1, :east do |u|
17
+ u.add_abilities :rescue!, :bind!
18
+ end
19
+
20
+ unit :sludge, 1, 0, :west
21
+ unit :captive, 1, 2, :west
22
+ unit :sludge, 0, 1, :west
23
+ unit :sludge, 2, 1, :west
@@ -0,0 +1,24 @@
1
+ # ----
2
+ # |C s |
3
+ # | @ S|
4
+ # |C s>|
5
+ # ----
6
+
7
+ description "Your ears become more in tune with the surroundings. Listen to find enemies and captives!"
8
+ tip "Use warrior.listen to find spaces with other units, and warrior.direction_of to determine what direction they're in."
9
+ clue "Walk towards an enemy or captive with warrior.walk!(warrior.direction_of(warrior.listen.first)), once warrior.listen.empty? then head for the stairs."
10
+
11
+ time_bonus 55
12
+ ace_score 144
13
+ size 4, 3
14
+ stairs 3, 2
15
+
16
+ warrior 1, 1, :east do |u|
17
+ u.add_abilities :listen, :direction_of
18
+ end
19
+
20
+ unit :captive, 0, 0, :east
21
+ unit :captive, 0, 2, :east
22
+ unit :sludge, 2, 0, :south
23
+ unit :thick_sludge, 3, 1, :west
24
+ unit :sludge, 2, 2, :north
@@ -0,0 +1,19 @@
1
+ # -----
2
+ # | S|
3
+ # |@> SC|
4
+ # -----
5
+
6
+ description "You can feel the stairs right next to you, but are you sure you want to go up them right away?"
7
+ tip "You'll get more points for clearing the level first. Use warrior.feel.stairs? and warrior.feel.empty? to determine where to go."
8
+ clue "If going towards a unit is the same direction as the stairs, try moving another empty direction until you can safely move toward the enemies."
9
+
10
+ time_bonus 45
11
+ ace_score 107
12
+ size 5, 2
13
+ stairs 1, 1
14
+
15
+ warrior 0, 1, :east
16
+
17
+ unit :thick_sludge, 4, 0, :west
18
+ unit :thick_sludge, 3, 1, :north
19
+ unit :captive, 4, 1, :west
@@ -0,0 +1,24 @@
1
+ # ------
2
+ # | SC >|
3
+ # |@ SC |
4
+ # ------
5
+
6
+ description "What's that ticking? Some captives have a timed bomb at their feet!"
7
+ tip "It's best to rescue captives first that have space.ticking?, they'll soon go!"
8
+ clue "Avoid fighting enemies at first. Go around them until you've rescued all of the ticking captives."
9
+
10
+ time_bonus 50
11
+ ace_score 130
12
+ size 6, 2
13
+ stairs 5, 0
14
+
15
+ warrior 0, 1, :east
16
+
17
+ unit :thick_sludge, 1, 0, :west
18
+ unit :thick_sludge, 3, 1, :west
19
+ unit :captive, 2, 0, :west do |u|
20
+ u.bomb_time = 6
21
+ end
22
+ unit :captive, 4, 1, :west do |u|
23
+ u.bomb_time = 10
24
+ end
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubywarrior
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Bates
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-02 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ 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.
17
+ email: ryan@railscasts.com
18
+ executables:
19
+ - rubywarrior
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ - CHANGELOG.rdoc
25
+ - LICENSE
26
+ files:
27
+ - lib/ruby_warrior/abilities/attack.rb
28
+ - lib/ruby_warrior/abilities/base.rb
29
+ - lib/ruby_warrior/abilities/bind.rb
30
+ - lib/ruby_warrior/abilities/direction_of.rb
31
+ - lib/ruby_warrior/abilities/direction_of_stairs.rb
32
+ - lib/ruby_warrior/abilities/distance.rb
33
+ - lib/ruby_warrior/abilities/explode.rb
34
+ - lib/ruby_warrior/abilities/feel.rb
35
+ - lib/ruby_warrior/abilities/health.rb
36
+ - lib/ruby_warrior/abilities/listen.rb
37
+ - lib/ruby_warrior/abilities/look.rb
38
+ - lib/ruby_warrior/abilities/pivot.rb
39
+ - lib/ruby_warrior/abilities/rescue.rb
40
+ - lib/ruby_warrior/abilities/rest.rb
41
+ - lib/ruby_warrior/abilities/shoot.rb
42
+ - lib/ruby_warrior/abilities/walk.rb
43
+ - lib/ruby_warrior/config.rb
44
+ - lib/ruby_warrior/core_additions.rb
45
+ - lib/ruby_warrior/floor.rb
46
+ - lib/ruby_warrior/game.rb
47
+ - lib/ruby_warrior/level.rb
48
+ - lib/ruby_warrior/level_loader.rb
49
+ - lib/ruby_warrior/player_generator.rb
50
+ - lib/ruby_warrior/position.rb
51
+ - lib/ruby_warrior/profile.rb
52
+ - lib/ruby_warrior/runner.rb
53
+ - lib/ruby_warrior/space.rb
54
+ - lib/ruby_warrior/tower.rb
55
+ - lib/ruby_warrior/turn.rb
56
+ - lib/ruby_warrior/ui.rb
57
+ - lib/ruby_warrior/units/archer.rb
58
+ - lib/ruby_warrior/units/base.rb
59
+ - lib/ruby_warrior/units/captive.rb
60
+ - lib/ruby_warrior/units/sludge.rb
61
+ - lib/ruby_warrior/units/thick_sludge.rb
62
+ - lib/ruby_warrior/units/warrior.rb
63
+ - lib/ruby_warrior/units/wizard.rb
64
+ - lib/ruby_warrior.rb
65
+ - spec/fixtures/short-tower/level_001.rb
66
+ - spec/fixtures/short-tower/level_002.rb
67
+ - spec/fixtures/walking_player.rb
68
+ - spec/ruby_warrior/abilities/attack_spec.rb
69
+ - spec/ruby_warrior/abilities/base_spec.rb
70
+ - spec/ruby_warrior/abilities/bind_spec.rb
71
+ - spec/ruby_warrior/abilities/direction_of_spec.rb
72
+ - spec/ruby_warrior/abilities/direction_of_stairs_spec.rb
73
+ - spec/ruby_warrior/abilities/distance_spec.rb
74
+ - spec/ruby_warrior/abilities/explode_spec.rb
75
+ - spec/ruby_warrior/abilities/feel_spec.rb
76
+ - spec/ruby_warrior/abilities/health_spec.rb
77
+ - spec/ruby_warrior/abilities/listen_spec.rb
78
+ - spec/ruby_warrior/abilities/look_spec.rb
79
+ - spec/ruby_warrior/abilities/pivot_spec.rb
80
+ - spec/ruby_warrior/abilities/rescue_spec.rb
81
+ - spec/ruby_warrior/abilities/rest_spec.rb
82
+ - spec/ruby_warrior/abilities/shoot_spec.rb
83
+ - spec/ruby_warrior/abilities/walk_spec.rb
84
+ - spec/ruby_warrior/floor_spec.rb
85
+ - spec/ruby_warrior/game_spec.rb
86
+ - spec/ruby_warrior/level_loader_spec.rb
87
+ - spec/ruby_warrior/level_spec.rb
88
+ - spec/ruby_warrior/player_generator_spec.rb
89
+ - spec/ruby_warrior/position_spec.rb
90
+ - spec/ruby_warrior/profile_spec.rb
91
+ - spec/ruby_warrior/space_spec.rb
92
+ - spec/ruby_warrior/tower_spec.rb
93
+ - spec/ruby_warrior/turn_spec.rb
94
+ - spec/ruby_warrior/ui_spec.rb
95
+ - spec/ruby_warrior/units/archer_spec.rb
96
+ - spec/ruby_warrior/units/base_spec.rb
97
+ - spec/ruby_warrior/units/captive_spec.rb
98
+ - spec/ruby_warrior/units/sludge_spec.rb
99
+ - spec/ruby_warrior/units/thick_sludge_spec.rb
100
+ - spec/ruby_warrior/units/warrior_spec.rb
101
+ - spec/ruby_warrior/units/wizard_spec.rb
102
+ - spec/spec_helper.rb
103
+ - features/command_options.feature
104
+ - features/levels.feature
105
+ - features/profiles.feature
106
+ - features/step_definitions/common_steps.rb
107
+ - features/step_definitions/interaction_steps.rb
108
+ - features/support/env.rb
109
+ - features/support/mockio.rb
110
+ - features/towers.feature
111
+ - towers/beginner/level_001.rb
112
+ - towers/beginner/level_002.rb
113
+ - towers/beginner/level_003.rb
114
+ - towers/beginner/level_004.rb
115
+ - towers/beginner/level_005.rb
116
+ - towers/beginner/level_006.rb
117
+ - towers/beginner/level_007.rb
118
+ - towers/beginner/level_008.rb
119
+ - towers/beginner/level_009.rb
120
+ - towers/intermediate/level_001.rb
121
+ - towers/intermediate/level_002.rb
122
+ - towers/intermediate/level_003.rb
123
+ - towers/intermediate/level_004.rb
124
+ - towers/intermediate/level_005.rb
125
+ - towers/intermediate/level_006.rb
126
+ - templates/player.rb
127
+ - templates/README.erb
128
+ - bin/rubywarrior
129
+ - LICENSE
130
+ - README.rdoc
131
+ - Rakefile
132
+ - CHANGELOG.rdoc
133
+ has_rdoc: true
134
+ homepage: http://github.com/ryanb/ruby-warrior
135
+ licenses: []
136
+
137
+ post_install_message:
138
+ rdoc_options:
139
+ - --line-numbers
140
+ - --inline-source
141
+ - --title
142
+ - RubyWarrior
143
+ - --main
144
+ - README.rdoc
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: "0"
152
+ version:
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: "1.2"
158
+ version:
159
+ requirements: []
160
+
161
+ rubyforge_project:
162
+ rubygems_version: 1.3.5
163
+ signing_key:
164
+ specification_version: 3
165
+ summary: Game written in Ruby for learning Ruby and artificial intelligence.
166
+ test_files: []
167
+