From: Konrad Meyer Date: 2007-11-02T03:00:36+09:00 Subject: Re: Paper scissors stone --nextPart27769053.e0rGS5vrau Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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. >=20 >=20 > Angelo What you're looking for is called reflection, and it's easy enough to do :D= =2E=20 If you have a common ancestor (RPSPlayer or somesuch) you can iterate throu= gh=20 ObjectSpace.each(Class) and look for ancestry, etc. Play around with it in= =20 irb. =2D-=20 Konrad Meyer http://konrad.sobertillnoon.com/ --nextPart27769053.e0rGS5vrau Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBHKhQzCHB0oCiR2cwRApaJAJ9P3XhYrsZLqziLvvutFK6IgpuyIgCfRPqP 6DwOJyTbl3MraOc5Vhgd2As= =gojK -----END PGP SIGNATURE----- --nextPart27769053.e0rGS5vrau--