From: Benoit Daloze on 10 Apr 2010 09:28 [Note: parts of this message were removed to make it a legal post.] On 10 April 2010 12:56, Philip Rhoades <phil(a)pricom.com.au> wrote: > Guys, > > 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) > > Not something I was expecting from something that is supposed to help teach > Ruby . . Well, what do you have in front of you? nothing, so you just need to warrior.walk! You'll get the feel method later, you don't need it yet as there is no enemy. (enemies will be shown on the map) B.D.
From: Philip Rhoades on 10 Apr 2010 09:45 Benoit, On 2010-04-10 23:28, Benoit Daloze wrote: > On 10 April 2010 12:56, Philip Rhoades<phil(a)pricom.com.au> wrote: > >> Guys, >> >> 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) >> >> Not something I was expecting from something that is supposed to help teach >> Ruby . . > > > Well, what do you have in front of you? nothing, so you just need to > warrior.walk! > You'll get the feel method later, you don't need it yet as there is no > enemy. (enemies will be shown on the map) Thanks - I didn't realise that all the methods were not immediately available - maybe the script should respond with something nicer than the ugly error messages in this case? Regards, Phil. -- Philip Rhoades GPO Box 3411 Sydney NSW 2001 Australia E-mail: phil(a)pricom.com.au
From: Aldric Giacomoni on 12 Apr 2010 08:24 Philip Rhoades wrote: > > > Thanks - I didn't realise that all the methods were not immediately > available - maybe the script should respond with something nicer than > the ugly error messages in this case? > That's a good idea. If I have time, maybe I'll try to submit a patch.. Or you could directly ask the developer :) -- Posted via http://www.ruby-forum.com/.
From: Robert Dober on 12 Apr 2010 13:46 On Sat, Apr 10, 2010 at 2:45 AM, thunk <gmkoller(a)gmail.com> wrote: Thunk your threads are fun but I would appreciate if you respected other threads, not everything can be fun, and you know depending on your answer I will be treated as a stupid troll feeder or a nice guy, I put my reputation into your hands, are you going to let me down? Kind regards Robert
From: Robert Dober on 12 Apr 2010 13:46 On Mon, Apr 12, 2010 at 7:46 PM, Robert Dober <robert.dober(a)gmail.com> wrote: > On Sat, Apr 10, 2010 at 2:45 AM, thunk <gmkoller(a)gmail.com> wrote: > Thunk > your threads are fun but I would appreciate if you respected other > threads, not everything can be fun, and you know depending on your > answer I will be treated as a stupid troll feeder or a nice guy, I put > my reputation into your hands, are you going to let me down? > > Kind regards > Robert > -- Learning without thought is labor lost; thought without learning is perilous. --- Confucius
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Camping 2.0 - minature rails for stay-at-home moms Next: Initial release of lightning |