[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Metaprogramming for Tierra-like (artificial life) program?

Phil Rhoades

11/28/2007 6:09:00 PM

People,

Would it be possible to use Ruby's metaprogramming ability to write
something like Tierra?:

http://www.nis.atr.jp/~ray/tierra/w...

http://www.nis.atr.jp/~ray/pu...

A quick summary for those who don't want to look at this site - Tierra
is an artificial life program using a virtual computer and virtual
machine code to allow "evolution" of self-reproducing code by mutation
(bit-flipping). Various "organisms" then evolve including hosts,
parasites, immune hosts, hyper-parasites etc

It would be a nice programming exercise for me (to learn more Ruby) if
something like Tierra was possible using metaprogramming (or any other
ruby facilities).

Regards,

Phil.
--
Philip Rhoades

Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
GPO Box 3411
Sydney NSW 2001
Australia
Fax: +61:(0)2-8221-9599
E-mail: phil@pricom.com.au


4 Answers

MonkeeSage

11/28/2007 11:45:00 PM

0

On Nov 28, 12:08 pm, Phil Rhoades <p...@pricom.com.au> wrote:
> People,
>
> Would it be possible to use Ruby's metaprogramming ability to write
> something like Tierra?:
>
> http://www.nis.atr.jp/~ray/tierra/w...
>
> http://www.nis.atr.jp/~ray/pu...
>
> A quick summary for those who don't want to look at this site - Tierra
> is an artificial life program using a virtual computer and virtual
> machine code to allow "evolution" of self-reproducing code by mutation
> (bit-flipping). Various "organisms" then evolve including hosts,
> parasites, immune hosts, hyper-parasites etc
>
> It would be a nice programming exercise for me (to learn more Ruby) if
> something like Tierra was possible using metaprogramming (or any other
> ruby facilities).
>
> Regards,
>
> Phil.
> --
> Philip Rhoades
>
> Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
> GPO Box 3411
> Sydney NSW 2001
> Australia
> Fax: +61:(0)2-8221-9599
> E-mail: p...@pricom.com.au

Sure, you can write a Game of Life in ruby. (You could even get fancy
and name it something else, like, say..."Tierra" ;P)

http://rubyforge.org/proje...

Regards,
Jordan

Phil Rhoades

11/29/2007 6:19:00 AM

0

Jordan,


On Thu, 2007-11-29 at 08:49 +0900, MonkeeSage wrote:
> On Nov 28, 12:08 pm, Phil Rhoades <p...@pricom.com.au> wrote:
> > People,
> >
> > Would it be possible to use Ruby's metaprogramming ability to write
> > something like Tierra?:
> >
> > http://www.nis.atr.jp/~ray/tierra/w...
> >
> > http://www.nis.atr.jp/~ray/pu...
> >
> > A quick summary for those who don't want to look at this site - Tierra
> > is an artificial life program using a virtual computer and virtual
> > machine code to allow "evolution" of self-reproducing code by mutation
> > (bit-flipping). Various "organisms" then evolve including hosts,
> > parasites, immune hosts, hyper-parasites etc
> >
> > It would be a nice programming exercise for me (to learn more Ruby) if
> > something like Tierra was possible using metaprogramming (or any other
> > ruby facilities).
> >
> > Regards,
> >
> > Phil.
> > --
> > Philip Rhoades
> >
> > Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
> > GPO Box 3411
> > Sydney NSW 2001
> > Australia
> > Fax: +61:(0)2-8221-9599
> > E-mail: p...@pricom.com.au
>
> Sure, you can write a Game of Life in ruby. (You could even get fancy
> and name it something else, like, say..."Tierra" ;P)
>
> http://rubyforge.org/proje...


I think you missed how Tierra is actually working . .

Phil.
--
Philip Rhoades

Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
GPO Box 3411
Sydney NSW 2001
Australia
Fax: +61:(0)2-8221-9599
E-mail: phil@pricom.com.au


Ilan Berci

11/29/2007 9:23:00 PM

0

Phil Rhoades wrote:
> People,
>
> Would it be possible to use Ruby's metaprogramming ability to write
> something like Tierra?:
>
>

Phil,

While I can't answer your question specifically, I can provide the
following information that you may find helpful.

Meta programing within ruby is very extensive with full support for
reflection and class, method, instance variable creation, etc... There
is virtually nothing that you can't create, modify, delete meta
programing wise from within the ruby runtime.

Please check out the methods eval() and class_eval() at your leisure

hth

ilan
--
Posted via http://www.ruby-....

MonkeeSage

11/29/2007 11:14:00 PM

0

On Nov 29, 12:19 am, Phil Rhoades <p...@pricom.com.au> wrote:
> Jordan,
>
>
>
> On Thu, 2007-11-29 at 08:49 +0900, MonkeeSage wrote:
> > On Nov 28, 12:08 pm, Phil Rhoades <p...@pricom.com.au> wrote:
> > > People,
>
> > > Would it be possible to use Ruby's metaprogramming ability to write
> > > something like Tierra?:
>
> > >http://www.nis.atr.jp/~ray/tierra/w...
>
> > >http://www.nis.atr.jp/~ray/pu...
>
> > > A quick summary for those who don't want to look at this site - Tierra
> > > is an artificial life program using a virtual computer and virtual
> > > machine code to allow "evolution" of self-reproducing code by mutation
> > > (bit-flipping). Various "organisms" then evolve including hosts,
> > > parasites, immune hosts, hyper-parasites etc
>
> > > It would be a nice programming exercise for me (to learn more Ruby) if
> > > something like Tierra was possible using metaprogramming (or any other
> > > ruby facilities).
>
> > > Regards,
>
> > > Phil.
> > > --
> > > Philip Rhoades
>
> > > Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
> > > GPO Box 3411
> > > Sydney NSW 2001
> > > Australia
> > > Fax: +61:(0)2-8221-9599
> > > E-mail: p...@pricom.com.au
>
> > Sure, you can write a Game of Life in ruby. (You could even get fancy
> > and name it something else, like, say..."Tierra" ;P)
>
> >http://rubyforge.org/proje...
>
> I think you missed how Tierra is actually working . .
>
> Phil.
> --
> Philip Rhoades
>
> Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
> GPO Box 3411
> Sydney NSW 2001
> Australia
> Fax: +61:(0)2-8221-9599
> E-mail: p...@pricom.com.au

Hi Phil,

Sorry about that. That was meant to be tongue-in-cheek. But the answer
is "yes" -- I don't see why you couldn't implement something like that
with ruby and metaprogramming (I thought the rlife project might be a
good starting point).

Regards,
Jordan