# Paper scissors stone

**URL:** <https://www.ruby-forum.com/t/paper-scissors-stone/118934>\
**Category:** Ruby\
**Created:** [November 1, 2007, 2:33pm UTC](https://www.ruby-forum.com/t/paper-scissors-stone/118934 "2007-11-01T14:33:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![angelojoseph17](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@angelojoseph17](https://www.ruby-forum.com/u/angelojoseph17)\
**Post date:** [November 1, 2007, 2:33pm UTC](https://www.ruby-forum.com/t/paper-scissors-stone/118934/1 "2007-11-01T14:33:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![angelojoseph17](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@angelojoseph17](https://www.ruby-forum.com/u/angelojoseph17)\
**Post date:** [November 1, 2007, 2:50pm UTC](https://www.ruby-forum.com/t/paper-scissors-stone/118934/2 "2007-11-01T14:50:57Z")

</div>

On Nov 1, 7:33 am, removed\_email\_address@domain.invalid 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](http://groups.google.com/group/comp.lang.ruby/browse_frm/thread/f6e73fb8b7468d0e/aac8ba5996898dc4?lnk=gst&q=scissors#aac8ba5996898dc4)

---

<div class="post-metadata">

**Author:** ![angelojoseph17](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@angelojoseph17](https://www.ruby-forum.com/u/angelojoseph17)\
**Post date:** [November 1, 2007, 6:28pm UTC](https://www.ruby-forum.com/t/paper-scissors-stone/118934/3 "2007-11-01T18:28:50Z")

</div>

Gavin K. wrote:

> On Nov 1, 7:33 am, removed\_email\_address@domain.invalid 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](http://www.rubyquiz.com/quiz16.html)

-r.

---

<div class="post-metadata">

**Author:** ![angelojoseph17](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@angelojoseph17](https://www.ruby-forum.com/u/angelojoseph17)\
**Post date:** [November 1, 2007, 7:17pm UTC](https://www.ruby-forum.com/t/paper-scissors-stone/118934/4 "2007-11-01T19:17:09Z")

</div>

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.
