Paper scissors stone

I’ve just started learning ruby at university and we are making a ruby
rock paper scissors game with all students making a ruby player. I was
wondering if there was a chance to find the function a player would use
i.e like paper and counter that with my own functions or even create a
super function like dynamite.

Angelo

On Nov 1, 7:33 am, [email protected] wrote:

I’ve just started learning ruby at university and we are making a ruby
rock paper scissors game with all students making a ruby player. I was
wondering if there was a chance to find the function a player would use
i.e like paper and counter that with my own functions or even create a
super function like dynamite.

See
http://groups.google.com/group/comp.lang.ruby/browse_frm/thread/f6e73fb8b7468d0e/aac8ba5996898dc4?lnk=gst&q=scissors#aac8ba5996898dc4

Gavin K. wrote:

On Nov 1, 7:33 am, [email protected] wrote:

I’ve just started learning ruby at university and we are making a ruby
rock paper scissors game with all students making a ruby player. I was
wondering if there was a chance to find the function a player would use
i.e like paper and counter that with my own functions or even create a
super function like dynamite.

See

There was a Ruby Q. about it:

http://www.rubyquiz.com/quiz16.html

-r.

Quoth Angelo Joseph:

I’ve just started learning ruby at university and we are making a ruby
rock paper scissors game with all students making a ruby player. I was
wondering if there was a chance to find the function a player would use
i.e like paper and counter that with my own functions or even create a
super function like dynamite.

Angelo

What you’re looking for is called reflection, and it’s easy enough to do
:D.
If you have a common ancestor (RPSPlayer or somesuch) you can iterate
through
ObjectSpace.each(Class) and look for ancestry, etc. Play around with it
in
irb.