Very cool! Proud to see that it's made with ImpactJS[1] (my game engine :))<p>[1] <a href="http://impactjs.com/" rel="nofollow">http://impactjs.com/</a>
Great...but how about turning down the music volume. It's 2:20am here, I opened the page and had a trouser changing moment and woke up the neighbours.
Nicely made. Some frustrations:<p>- while, until, retry (and others?) not allowed.<p>- not being able to see the class of something. Its more ruby style to do 'space.is_a?(Enemy)' than 'space.enemy?'. This would also help to build case statements rather than lots of ifs.<p>- no 'print' or 'puts'. How am I supposed to know what 'look' returns when it never really tells me?<p>- I prefer a single set of rules rather than adding rules as you go. When first I have to use :backward but later this becomes basically redundant as 'pivot' is added, it just makes me frustrated in having to refactor. Same thing for feel/look.
This should win every level (given enough tries):<p><pre><code> def play_turn(warrior)
m = warrior.methods.grep(/.!$/).sample
warrior.send(m, *([nil, :backward].sample if m != :rest!))
end
</code></pre>
(that sucker of :rest! that doesn't accept a direction argument!)<p>It's kind of amusing to see the warrior do random stuff like shooting arrows backwards and pivoting back in the worst possible moments. Too bad that Run button repeats the same movements if you didn't edit the source code somehow.<p>Great game and concept BTW!
Had a lot of fun with my rusty Ruby on this game. Here's my solution to beat level 3 onwards:<p><a href="https://gist.github.com/hcarvalhoalves/6096888" rel="nofollow">https://gist.github.com/hcarvalhoalves/6096888</a>
It would be cool if the game commited your code to a github repo every level.<p>This way you could see your own progress, and see what solutions other came up with without bugging them.
Had to implement a<p><pre><code> if not warrior
return nil
end
</code></pre>
in the play_turn method, to workaround a bug. But other than that, this is great!
Akkk... sound... must... turn... off!!!<p>Ok default sound way too loud, and at least on Safari the little speaker icon in the top left doesn't seem to do anything.
I am really disappointed that Ryan Bates is not being STRONGLY credited anywhere on this page... this is just a graphical wrapper on his original creation.<p><a href="https://github.com/ryanb/ruby-warrior" rel="nofollow">https://github.com/ryanb/ruby-warrior</a>
Feature request: After you've beaten it once let you go through all levels with the same code. Right now it doesn't let you use the features it hasn't told you about.
As someone who has never done any development in Ruby. I loved the idea and wanted to use. However what makes it not accessible is that you give no instruction initially on the structure of Ruby syntax. This means that I would need to follow another book or tutorial. Please consider drip feeding the player a syntax cheat sheet that will help with each level .
Oh goddamn, this is amazing. As someone who hasn't even seen Ruby code before, you could include a bit more on the syntax of conditional/loop constructs (if/while/etc), but it's amazing. I'll send this to my non-programmer friends right now.
Cool idea, but I don't think it makes sense for there to be both a Player class and a warrior object. They seem like they are/should be one in the same. At the very least, I think behind the scenes, the Player class should look more like this such that the warrior object is always available, and I don't need to pass it around from method to method that I define. e.g.:<p><pre><code> class Player
attr_reader :warrior
def initialize(warrior)
@warrior = warrior
end
def play_turn
# I can now access `warrior` here or in any other methods I write
end
end</code></pre>
This is really great, but it would be even better if it showed where the error it's finding is located. I am getting some weird errors that I can't spot-find.
They should also add the intermediate levels as well<p><a href="https://github.com/ryanb/ruby-warrior/tree/master/towers/intermediate" rel="nofollow">https://github.com/ryanb/ruby-warrior/tree/master/towers/int...</a>
kneel down before the warrior (all levels): <a href="https://gist.github.com/syasrebi/6097679" rel="nofollow">https://gist.github.com/syasrebi/6097679</a>