Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Dwemthy's Array -- the Ruby mini_adventure
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  17 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
why the lucky stiff  
View profile  
 More options Mar 23 2005, 12:11 pm
Newsgroups: comp.lang.ruby
From: why the lucky stiff <ruby-t...@whytheluckystiff.net>
Date: Thu, 24 Mar 2005 02:11:29 +0900
Local: Wed, Mar 23 2005 12:11 pm
Subject: [ANN] Dwemthy's Array -- the Ruby mini_adventure
Since you were a very young rabbit in little cotton pants, Dwemthy's
Array has breathed on your neck and you're tired of it.  You draw your
glistening Hero's Sword from its sheath and cut a low-circling falcon in
half as a confidence building exercise.  Your eyes flick about in a cool
and freaky way.

You're ready...  It's time to stare this construct in the face.

$$$ DWEMTHY_S ARRAY ^!^ A RUBY MINI_DUNGEON ^!^ CODE TO KILL BY $$$

Here, try this: http://poignantguide.net/dwemthy/

The sixth chapter of Why's (Poignant) Guide to Ruby is on its way.  This
chapter covers metaclasses and method_missing with the help of Dwemthy's
demonic list.  The code for the little RPG is now available.  A full
explanation is forthcoming in chapter six.

Please send your hacks to the poignant-stiffs list.  Subscription
information is at http://poignant.rubyforge.org/.

_why


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
CT  
View profile  
 More options Mar 23 2005, 12:23 pm
Newsgroups: comp.lang.ruby
From: CT <demer...@gmail.com>
Date: Thu, 24 Mar 2005 02:23:47 +0900
Local: Wed, Mar 23 2005 12:23 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure
On Thu, 24 Mar 2005 02:11:29 +0900, why the lucky stiff

<ruby-t...@whytheluckystiff.net> wrote:

> Here, try this: http://poignantguide.net/dwemthy/

Man.. I'm in tears here.
*sob*

> _why

Shajith

PS: Hurry up with chapter 6, will ya? :D


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jacob Fugal  
View profile  
 More options Mar 23 2005, 1:07 pm
Newsgroups: comp.lang.ruby
From: Jacob Fugal <lukf...@gmail.com>
Date: Thu, 24 Mar 2005 03:07:24 +0900
Local: Wed, Mar 23 2005 1:07 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure
On Thu, 24 Mar 2005 02:11:29 +0900, why the lucky stiff

<ruby-t...@whytheluckystiff.net> wrote:
> You're ready...  It's time to stare this construct in the face.

> $$$ DWEMTHY_S ARRAY ^!^ A RUBY MINI_DUNGEON ^!^ CODE TO KILL BY $$$

> Here, try this: http://poignantguide.net/dwemthy/

Is it just me or is the DwemthysArray symbol never defined on that
page? I defeated the ScubaArgentine and am eager to fight the Dragon!

- Jacob Fugal


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
why the lucky stiff  
View profile  
 More options Mar 23 2005, 1:24 pm
Newsgroups: comp.lang.ruby
From: why the lucky stiff <ruby-t...@whytheluckystiff.net>
Date: Thu, 24 Mar 2005 03:24:46 +0900
Local: Wed, Mar 23 2005 1:24 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure

Jacob Fugal wrote:
> Is it just me or is the DwemthysArray symbol never defined on that

>page? I defeated the ScubaArgentine and am eager to fight the Dragon!

Well done, hero.  You have discovered a weakness in Dwemthy's Array!!  
This has been a crucial part of your training.  You have learned to spot
omissions in the mechanisms of life!!  ANd you have charged up to the
great god of the sky and thrust your javelin in the sky and bellowed
great screams, chiding the powers of speed and atmosphere, that you will
not accept this, that your honor and nobility is owed far greater than
this!!

Well done, I say.  Raise a chalice of valor!!  Let the mead flow thickly
through our devoursome fingers and ankle beards!!

_why


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Phil Tomson  
View profile  
 More options Mar 23 2005, 1:57 pm
Newsgroups: comp.lang.ruby
From: pt...@aracnet.com (Phil Tomson)
Date: 23 Mar 2005 18:57:28 GMT
Local: Wed, Mar 23 2005 1:57 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure
In article <50756767050323100730f7f...@mail.gmail.com>,
Jacob Fugal  <lukf...@gmail.com> wrote:

>On Thu, 24 Mar 2005 02:11:29 +0900, why the lucky stiff
><ruby-t...@whytheluckystiff.net> wrote:
>> You're ready...  It's time to stare this construct in the face.

>> $$$ DWEMTHY_S ARRAY ^!^ A RUBY MINI_DUNGEON ^!^ CODE TO KILL BY $$$

>> Here, try this: http://poignantguide.net/dwemthy/

>Is it just me or is the DwemthysArray symbol never defined on that
>page? I defeated the ScubaArgentine and am eager to fight the Dragon!

No one knows how those hideous creatures got in DwemthysArray and no one
knows where DwemthysArray comes from either.

...yeah, I ran into the same problem.

How about:

dwar = [IndustrialRaverMonkey.new,
                      DwarvenAngel.new,
                      AssistantViceTentacleAndOmbudsman.new,
                      TeethDeer.new,
                      IntrepidDecomposedCyclist.new,
                      Dragon.new]

dwar.each {|creature|
   r ^ creature

}

...but I get:

[Rabbit is too dead to fight!]
[Rabbit is too dead to fight!]
[Rabbit is too dead to fight!]
[Rabbit is too dead to fight!]
[Rabbit is too dead to fight!]
[Rabbit is too dead to fight!]

No doubt _why has put some magic in DwemthysArray that we're missing.

Phil


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Patrick Hurley  
View profile  
 More options Mar 23 2005, 3:06 pm
Newsgroups: comp.lang.ruby
From: Patrick Hurley <phur...@gmail.com>
Date: Thu, 24 Mar 2005 05:06:39 +0900
Local: Wed, Mar 23 2005 3:06 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure

> No doubt _why has put some magic in DwemthysArray that we're missing.

He has that cool method_missing stuff where the method you are trying
to use against his array is sent to the first item in the array. If
the life trait runs out of the entry he shifts it out and brings on
the next one. It is a nice little idiom -- I like it.

Of course the only way I could beat the array was with a little smoke
and mirrors:

r = Rabbit.new
r.life = 9999

seemed to help a lot :-)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
why the lucky stiff  
View profile  
 More options Mar 23 2005, 7:32 pm
Newsgroups: comp.lang.ruby
From: why the lucky stiff <ruby-t...@whytheluckystiff.net>
Date: Thu, 24 Mar 2005 09:32:10 +0900
Local: Wed, Mar 23 2005 7:32 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure

Patrick Hurley wrote:

> r = Rabbit.new
> r.life = 9999

See, hex-editing is 10x fasterrr in Ruby, too.

ALls I can say is: you sure skipped a lot of lettuce-eating.

_why


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Patrick Hurley  
View profile  
 More options Mar 23 2005, 7:37 pm
Newsgroups: comp.lang.ruby
From: Patrick Hurley <phur...@gmail.com>
Date: Thu, 24 Mar 2005 09:37:48 +0900
Local: Wed, Mar 23 2005 7:37 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure
Oh btw, if you keep at it the DwemthysArray gets a little nasty
sending messages to Nil and nil does not seem to appreciate the extra
attention. So a minor change like below seems to help.

Thanks as always for the enjoyable read, yours is one of the more
interesting ways to introduce people to Ruby.

Patrick

*** dwemthy-orig.rb     Wed Mar 23 14:33:52 2005
--- dwemthy.rb  Wed Mar 23 15:20:07 2005
***************
*** 64,76 ****
    alias _inspect inspect
    def inspect; "#<#{ self.class }#{ _inspect }>"; end
    def method_missing( meth, *args )
      answer = first.send( meth, *args )
!     if first.life <= 0
!       shift
!       if empty?
!         puts "[Whoa.  You decimated Dwemthy's Array!]"
!       else
!         puts "[Get ready. #{ first.class } has emerged.]"
        end
      end
      answer || 0
--- 64,80 ----
    alias _inspect inspect
    def inspect; "#<#{ self.class }#{ _inspect }>"; end
    def method_missing( meth, *args )
+     if empty?
+       puts "[Quit flogging my dead monsters!]"
+     else
      answer = first.send( meth, *args )
!       if first.life <= 0
!         shift
!         if empty?
!           puts "[Whoa.  You decimated Dwemthy's Array!]"
!         else
!           puts "[Get ready. #{ first.class } has emerged.]"
!         end
        end
      end
      answer || 0


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
vruz  
View profile  
 More options Mar 23 2005, 8:29 pm
Newsgroups: comp.lang.ruby
From: vruz <horacio.lo...@gmail.com>
Date: Thu, 24 Mar 2005 10:29:48 +0900
Local: Wed, Mar 23 2005 8:29 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure

> Since you were a very young rabbit in little cotton pants, Dwemthy's
> Array has breathed on your neck and you're tired of it.  You draw your
> glistening Hero's Sword from its sheath and cut a low-circling falcon in
> half as a confidence building exercise.  Your eyes flick about in a cool
> and freaky way.

shine on you crazy diamond

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shalev NessAiver  
View profile  
 More options Mar 23 2005, 8:52 pm
Newsgroups: comp.lang.ruby
From: Shalev NessAiver <sha...@simplyphysics.com>
Date: Thu, 24 Mar 2005 10:52:34 +0900
Local: Wed, Mar 23 2005 8:52 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure

On Mar 23, 2005, at 7:32 PM, why the lucky stiff wrote:

> ALls I can say is: you sure skipped a lot of lettuce-eating.

> _why

Yeah, I figured that part out.  The only way is to frngllheeg aahhh
help- askdfjj.

[ Sorry about that folks, Shalev was called away on an emergency.
  Go back to your normal lives people. ]


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brian McCallister  
View profile  
 More options Mar 24 2005, 8:58 am
Newsgroups: comp.lang.ruby
From: Brian McCallister <bri...@apache.org>
Date: Thu, 24 Mar 2005 22:58:01 +0900
Local: Thurs, Mar 24 2005 8:58 am
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure
r = Rabbit.new
1000000.times { r % r }

is maybe a bit less of a hack ;-)

technically

maybe

-Brian

On Mar 23, 2005, at 8:52 PM, Shalev NessAiver wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shalev NessAiver  
View profile  
 More options Mar 24 2005, 2:28 pm
Newsgroups: comp.lang.ruby
From: Shalev NessAiver <sha...@simplyphysics.com>
Date: Fri, 25 Mar 2005 04:28:44 +0900
Local: Thurs, Mar 24 2005 2:28 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure
Except that that doesn't always work.  You'll still die some of the
time.

It may be better to switch over to more damaging weapons somewhere down
the line.
(After you've gotten a bunch of life from the early guys).

-Shalev

On Mar 24, 2005, at 8:58 AM, Brian McCallister wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Patrick Hurley  
View profile  
 More options Mar 24 2005, 2:36 pm
Newsgroups: comp.lang.ruby
From: Patrick Hurley <phur...@gmail.com>
Date: Fri, 25 Mar 2005 04:36:15 +0900
Local: Thurs, Mar 24 2005 2:36 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure
I think you missed he was using the lettuce on himself (rabbit on
rabbit action for those of you into that sort of thing). So he was
boosting his life before he started on any of the guys in the array.

On Fri, 25 Mar 2005 04:28:44 +0900, Shalev NessAiver


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
why the lucky stiff  
View profile  
 More options Mar 24 2005, 3:17 pm
Newsgroups: comp.lang.ruby
From: why the lucky stiff <ruby-t...@whytheluckystiff.net>
Date: Fri, 25 Mar 2005 05:17:31 +0900
Local: Thurs, Mar 24 2005 3:17 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure

Brian McCallister wrote:
> r = Rabbit.new
> 1000000.times { r % r }

> is maybe a bit less of a hack ;-)

Ladies and gentleman, may I have your attention and give a warm welcome
to: Our Hero and His One-Million Acts of Bulemic Self-Bludgeoning!!

_why


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shalev NessAiver  
View profile  
 More options Mar 24 2005, 3:41 pm
Newsgroups: comp.lang.ruby
From: Shalev NessAiver <sha...@simplyphysics.com>
Date: Fri, 25 Mar 2005 05:41:40 +0900
Local: Thurs, Mar 24 2005 3:41 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure
Hmmm, you're right.  I was hitting the ENEMIES with the lettuce.

Doing it to myself seemed....cheating.

-Shalev

On Mar 24, 2005, at 2:36 PM, Patrick Hurley wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Florian Gross  
View profile  
 More options Mar 24 2005, 3:45 pm
Newsgroups: comp.lang.ruby
From: Florian Gross <f...@ccan.de>
Date: Thu, 24 Mar 2005 21:45:39 +0100
Local: Thurs, Mar 24 2005 3:45 pm
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure

Brian McCallister wrote:
> r = Rabbit.new
> 1000000.times { r % r }

Now that's what I call real power gaming!

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Burt  
View profile  
 More options Mar 25 2005, 3:54 am
Newsgroups: comp.lang.ruby
From: "Dave Burt" <d...@burt.id.au>
Date: Fri, 25 Mar 2005 08:54:00 GMT
Subject: Re: [ANN] Dwemthy's Array -- the Ruby mini_adventure
"why the lucky stiff" <ruby-t...@whytheluckystiff.net> tootled:

> $$$ DWEMTHY_S ARRAY ^!^ A RUBY MINI_DUNGEON ^!^ CODE TO KILL BY $$$

> Here, try this: http://poignantguide.net/dwemthy/

I have a couple of things to share with the crazy Ruby
meta-dungeon-programmeering community.

First, I found this cheat code on the internet:
class Rabbit
  # you can defeat enemies easily with the
  # secret cheater's laser gun
  def =~( enemy )
    fight( enemy, 2691 )
  end
end

It reminds me of the little laser soldiers in Age of Empires.

It allows the Rabbit to laser things to death like this:

> r=~ Dragon.new

[You hit with 2181 points of damage!]
[Dragon has died.]
#<Dragon:0x2ac8dc8 @life=-841, @weapon=939, @charisma=1020, @strength=451>

And sometimes like this, which isn't as good for the Rabbit:

> r =~ Dragon.new

[You hit with 368 points of damage!]
#<Dragon:0x2abf288 @life=972, @weapon=939, @charisma=1020, @strength=451>
[Your enemy hit with 699 points of damage!]
[Rabbit has died.]

Secondly, I put together this strategy that any Rabbit can use to defeat
DwemthysArray 1.0, without using lasers or anything dodgy like that.
# requires Patrick Hurley's [Quit flogging my dead monsters!] patch
# to DwemthysArray to work properly
class Rabbit
  def battle( enemy )
    stats = Hash.new(0)
    while enemy.life > 0 || self.life <= 0
      weapon = if self.life <= 0 then             :%
               elsif enemy.life % 10 >= 5 then    :/
               elsif bombs and rand < (0.1) then  :*
               else                               :^
               end
      send weapon, enemy
      stats[weapon] += 1
    end
    total = 0
    stats.each_pair do |weapon, uses|
      puts "[#{ self.class } used #{weapon} #{uses} times]"
      total += uses
    end
    puts "[#{ self.class } attacked a total of #{total} times in that
battle.]"
  end
end

Output:

> r.battle DwemthysArray.new

...
[Rabbit is too dead to fight!]
[Healthy lettuce gives you 42 life points!!]
[You hit with 1 points of damage!]
[Dragon has died.]
[Whoa.  You decimated Dwemthy's Array!]
#<DwemthysArray[]>
[Quit flogging my dead monsters!]
[Quit flogging my dead monsters!]
[Rabbit used / 79 times]
[Rabbit used % 101007 times]
[Rabbit used * 3 times]
[Rabbit used ^ 89 times]
[Rabbit attacked a total of 101178 times in that battle.]
=> nil
irb(main):012:0> r
=> #<Rabbit:0x2ab9b88 @life=4, @weapon=4, @bombs=2, @charisma=44,
@strength=2>

And finally, I would also propose the following patch, to stop the Rabbit's
ability to eat when he or she is dead, but it makes the game too difficult:
--- rabbit.rb
+++ rabbit.rb
@@ -18,6 +18,10 @@
   # lettuce will build your strength and extra ruffage
   # will fly in the face of your opponent!!
   def %( enemy )
+    if life <= 0
+      puts "[You are beyond the help of the healthy lettuce.]"
+      return
+    end
     lettuce = rand( charisma )
     puts "[Healthy lettuce gives you #{ lettuce } life points!!]"
     @life += lettuce

Happy meta-dungeon-programmeering!

Cheers,
Dave


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google