From: Philip Rhoades Date: 2010-04-10T22:45:19+09:00 Subject: Re: Ruby-warrior : Teaching AI concepts with Ruby Benoit, On 2010-04-10 23:28, Benoit Daloze wrote: > On 10 April 2010 12:56, Philip Rhoades 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 # >> (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@pricom.com.au