TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

RubyWarrior - Bloc

251 pointsby Dekkualmost 12 years ago

31 comments

phoboslabalmost 12 years ago
Very cool! Proud to see that it&#x27;s made with ImpactJS[1] (my game engine :))<p>[1] <a href="http://impactjs.com/" rel="nofollow">http:&#x2F;&#x2F;impactjs.com&#x2F;</a>
评论 #6114837 未加载
teh_klevalmost 12 years ago
Great...but how about turning down the music volume. It&#x27;s 2:20am here, I opened the page and had a trouser changing moment and woke up the neighbours.
twelvechairsalmost 12 years ago
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 &#x27;space.is_a?(Enemy)&#x27; than &#x27;space.enemy?&#x27;. This would also help to build case statements rather than lots of ifs.<p>- no &#x27;print&#x27; or &#x27;puts&#x27;. How am I supposed to know what &#x27;look&#x27; 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 &#x27;pivot&#x27; is added, it just makes me frustrated in having to refactor. Same thing for feel&#x2F;look.
评论 #6115886 未加载
评论 #6115509 未加载
评论 #6116947 未加载
评论 #6115530 未加载
评论 #6115605 未加载
评论 #6115717 未加载
epidemianalmost 12 years ago
This should win every level (given enough tries):<p><pre><code> def play_turn(warrior) m = warrior.methods.grep(&#x2F;.!$&#x2F;).sample warrior.send(m, *([nil, :backward].sample if m != :rest!)) end </code></pre> (that sucker of :rest! that doesn&#x27;t accept a direction argument!)<p>It&#x27;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&#x27;t edit the source code somehow.<p>Great game and concept BTW!
评论 #6115685 未加载
评论 #6115435 未加载
hcarvalhoalvesalmost 12 years ago
Had a lot of fun with my rusty Ruby on this game. Here&#x27;s my solution to beat level 3 onwards:<p><a href="https://gist.github.com/hcarvalhoalves/6096888" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;hcarvalhoalves&#x2F;6096888</a>
hayksaakianalmost 12 years ago
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.
评论 #6137733 未加载
saebekassebilalmost 12 years ago
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!
joshuakalmost 12 years ago
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&#x27;t seem to do anything.
jtmsalmost 12 years ago
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:&#x2F;&#x2F;github.com&#x2F;ryanb&#x2F;ruby-warrior</a>
评论 #6117036 未加载
评论 #6116981 未加载
stormbrewalmost 12 years ago
Feature request: After you&#x27;ve beaten it once let you go through all levels with the same code. Right now it doesn&#x27;t let you use the features it hasn&#x27;t told you about.
jimparkinsalmost 12 years ago
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 .
marcamillionalmost 12 years ago
This is VERY, VERY awesome.<p>As a web-rubyist, this forces me to think in a different way than I normally would.<p>Thank you for making this.
StavrosKalmost 12 years ago
Oh goddamn, this is amazing. As someone who hasn&#x27;t even seen Ruby code before, you could include a bit more on the syntax of conditional&#x2F;loop constructs (if&#x2F;while&#x2F;etc), but it&#x27;s amazing. I&#x27;ll send this to my non-programmer friends right now.
lostdogalmost 12 years ago
It would be great if either `print` or `puts` worked.
评论 #6114994 未加载
matthugginsalmost 12 years ago
Cool idea, but I don&#x27;t think it makes sense for there to be both a Player class and a warrior object. They seem like they are&#x2F;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&#x27;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>
评论 #6114699 未加载
评论 #6115021 未加载
joemclarkealmost 12 years ago
This is awesome, glad to see I can put my ruby skills to good use playing a game!
mmanfrinalmost 12 years ago
This is really great, but it would be even better if it showed where the error it&#x27;s finding is located. I am getting some weird errors that I can&#x27;t spot-find.
评论 #6116895 未加载
DanielRibeiroalmost 12 years ago
Discussion from yesterday: <a href="https://news.ycombinator.com/item?id=6110382" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=6110382</a>
Strategoalmost 12 years ago
I really like how this manages to introduce some object-oriented principles stealthily while mostly focusing on linear logic. Great job!
hardwaresoftonalmost 12 years ago
First couple seconds was wondering where the hell the sound was coming from, rest of the seconds were in awe. Awesome job.
nonrecursivealmost 12 years ago
Oh man, I love this!<p>I especially loved this: &quot;warrior.feel.empty?&quot;. Allova sudden my RubyWarrior&#x27;s getting all existential!
ulisesrmzrochealmost 12 years ago
How do you tell the character to stop on a space when walking? That monster keeps killing me.
评论 #6114527 未加载
hayksaakianalmost 12 years ago
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:&#x2F;&#x2F;github.com&#x2F;ryanb&#x2F;ruby-warrior&#x2F;tree&#x2F;master&#x2F;towers&#x2F;int...</a>
chrischenalmost 12 years ago
You should do a score based on the number of lines of code or characters you have to use.
soheilalmost 12 years ago
kneel down before the warrior (all levels): <a href="https://gist.github.com/syasrebi/6097679" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;syasrebi&#x2F;6097679</a>
评论 #6116024 未加载
Lord_DeathMatchalmost 12 years ago
&quot;undefined method `elements&#x27; for [:return0]:Array&quot;<p>Marvelous
评论 #6119616 未加载
lcedpalmost 12 years ago
Does anyone know more games like this? Thanks.
gpxlalmost 12 years ago
This is a lot of fun. Well done! :)
Bluestrike2almost 12 years ago
Ok, that&#x27;s kind of fun :).
lcedpalmost 12 years ago
I made it. It was great!
innguestalmost 12 years ago
This is very cool. I hope others copy your idea - very nice way to marry programming with games.