From: Ryan Davis on

On Apr 9, 2010, at 10:20 , Aldric Giacomoni wrote:

> I think this project doesn't get enough attention :-)
> http://github.com/ryanb/ruby-warrior
>
> I've tried it and it's really cool and entertaining. The code is also
> pretty cool to look at, and it's got tests and everything.
> What is your opinion of it? How far can you go before you have to
> actually think? :)

That looks really really cool. I'll have to play with that this weekend. Thanks!


From: Philip Rhoades on
People,


On 2010-04-10 05:35, H- 16 wrote:
> Bill Kelly wrote:
> Aldric Giacomoni wrote:
>> I think this project doesn't get enough attention :-)
>> http://github.com/ryanb/ruby-warrior
>
> Oh, definately, this is probably the best way to teach programing.


I tried cloning the latest git but adding

warrior.rest!

to player.rb and running gave:

Welcome to Ruby Warrior
[1] p - beginner - level 1 - score 0
[2] New Profile
Choose profile by typing the number: 1
Starting Level 1
- turn 1 -
--------
|@ >|
--------
/rubywarrior/p-beginner/player.rb:3:in `play_turn': undefined method
`rest!' for #<RubyWarrior::Turn:0x7f5f0ced1a58 @action=nil, @senses={}>
(NoMethodError)
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/units/warrior.rb:12:in
`play_turn'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/units/base.rb:72:in
`prepare_turn'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/level.rb:50:in
`play'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/level.rb:50:in
`each'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/level.rb:50:in
`play'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/level.rb:46:in
`times'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/level.rb:46:in
`play'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/game.rb:72:in
`play_current_level'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/game.rb:63:in
`play_normal_mode'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/game.rb:23:in
`start'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/runner.rb:17:in
`run'
from /usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/rubywarrior:5


What have I missed?

Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail: phil(a)pricom.com.au

From: Ryan Davis on

On Apr 9, 2010, at 23:38 , Philip Rhoades wrote:

> People,
>
>
> On 2010-04-10 05:35, H- 16 wrote:
>> Bill Kelly wrote:
>> Aldric Giacomoni wrote:
>>> I think this project doesn't get enough attention :-)
>>> http://github.com/ryanb/ruby-warrior
>>
>> Oh, definately, this is probably the best way to teach programing.
>
>
> I tried cloning the latest git but adding
>
> warrior.rest!
>
> to player.rb and running gave:
>
...
> ./rubywarrior/p-beginner/player.rb:3:in `play_turn': undefined method `rest!' for #<RubyWarrior::Turn:0x7f5f0ced1a58 @action=nil, @senses={}> (NoMethodError)
> from /usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/units/warrior.rb:12:in `play_turn'
> ...
> What have I missed?

I dunno as I haven't played with the code yet, but you're calling rest! on a Turn, not on the Warrior. Make sure your warrior variable (or method call result?) is what you think it is.

Make sure you still have something like:

class Player
def play_turn(warrior)



From: Benoit Daloze on
[Note: parts of this message were removed to make it a legal post.]

Hi,
On 10 April 2010 08:38, Philip Rhoades <phil(a)pricom.com.au> wrote:

> People,
>
> I tried cloning the latest git but adding
>
> warrior.rest!
>
> to player.rb and running gave:
>
> Welcome to Ruby Warrior
> [1] p - beginner - level 1 - score 0
> [2] New Profile
> Choose profile by typing the number: 1
> Starting Level 1
> - turn 1 -
> --------
> |@ >|
> --------
> ./rubywarrior/p-beginner/player.rb:3:in `play_turn': undefined method
> `rest!' for #<RubyWarrior::Turn:0x7f5f0ced1a58 @action=nil, @senses={}>
> (NoMethodError)
>
> What have I missed?
>
> You just can't warrior.rest! on level 1, warrior methods are added level by
level.

And, why would you rest when you can just go straight ahead? ;)

B.D.

From: Philip Rhoades on
Guys,


On 2010-04-10 18:11, Ryan Davis wrote:
>
> On Apr 9, 2010, at 23:38 , Philip Rhoades wrote:
>
>> People,
>>
>>
>> On 2010-04-10 05:35, H- 16 wrote:
>>> Bill Kelly wrote: Aldric Giacomoni wrote:
>>>> I think this project doesn't get enough attention :-)
>>>> http://github.com/ryanb/ruby-warrior
>>>
>>> Oh, definately, this is probably the best way to teach
>>> programing.
>>
>>
>> I tried cloning the latest git but adding
>>
>> warrior.rest!
>>
>> to player.rb and running gave:
>>
> ...
>> ./rubywarrior/p-beginner/player.rb:3:in `play_turn': undefined
>> method `rest!' for #<RubyWarrior::Turn:0x7f5f0ced1a58 @action=nil,
>> @senses={}> (NoMethodError) from
>> /usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/units/warrior.rb:12:in
>> `play_turn'
>>
>>... What have I missed?
>
> I dunno as I haven't played with the code yet, but you're calling
> rest! on a Turn, not on the Warrior. Make sure your warrior variable
> (or method call result?) is what you think it is.
>
> Make sure you still have something like:
>
> class Player def play_turn(warrior)


I just used something simple above because the example stuff gave me the
same problem - that is, using:

class Player
def play_turn(warrior)
if warrior.feel.enemy?
warrior.attack!
else
warrior.walk!
end
end
end

results in:

Welcome to Ruby Warrior
[1] p - beginner - level 1 - score 0
[2] New Profile
Choose profile by typing the number: 1
Starting Level 1
- turn 1 -
--------
|@ >|
--------
/rubywarrior/p-beginner/player.rb:3:in `play_turn': undefined method
`feel' for #<RubyWarrior::Turn:0x7f4c176e0680 @action=nil, @senses={}>
(NoMethodError)
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/units/warrior.rb:12:in
`play_turn'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/units/base.rb:72:in
`prepare_turn'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/level.rb:50:in
`play'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/level.rb:50:in
`each'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/level.rb:50:in
`play'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/level.rb:46:in
`times'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/level.rb:46:in
`play'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/game.rb:72:in
`play_current_level'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/game.rb:63:in
`play_normal_mode'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/game.rb:23:in
`start'
from
/usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/../lib/ruby_warrior/runner.rb:17:in
`run'
from /usr/lib/ruby/gems/1.8/gems/ruby-warrior/bin/rubywarrior:5

Not something I was expecting from something that is supposed to help
teach Ruby . .

Thanks,

Phil.
--
Philip Rhoades

GPO Box 3411
Sydney NSW 2001
Australia
E-mail: phil(a)pricom.com.au