We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Help with modifying older code
Page Index Toggle Pages: 1
Help with modifying older code (Read 835 times)
Help with modifying older code
Feb 10th, 2010, 1:49pm
 
I found some older code from Processing 0123 in 2006, and it doesn't work on 1.x because of syntax changes, but I don't know how to change it so it does work.

It's probably only a few things that actually need changing, but I'm not a programmer, so it's beyond me. Would anyone like to modify it for me? It's several files, so I can't post all the code, but I could email it to you if you want to work on it.
Re: Help with modifying older code
Reply #1 - Feb 10th, 2010, 4:43pm
 
THIS is what he's trying to get working in a current version of Processing, if anyone else wants a shot at it.

So far I've changed:
"gene.dna()" to "gene.dna" where ever it appears
"//import gaLibrary.*;" to "import ai_ga.*;"

Now it's having issues with kill() called on a Particle, and I know I should change that to
"void removeParticle( int index )"
or
"void removeParticle( Particle p )"
but I can't get that working, and it's making me crazy.  Cheesy
Anyone else want to give it a try
Re: Help with modifying older code
Reply #2 - Feb 12th, 2010, 1:03am
 
{ Also posted in Older Processing Versions thread }

I have had a look at Eye for an Eye, which is very nice.

I downloaded the code, and downloaded and installed the referenced libraries (Traer Physics and the Genetic Algorithm Library created by the sketch's author).

The only Processing change is framereate() being renamed to frameRate(), and when I tried to "Run" the sketch, the Processing Language (API) - Changes page popped up in a browser window to tell me about it.

There are also (documented) changes to the Traer Physics library, and undocumented changes to the Genetic Algorithm library.

After an hour or so of working on it, I have a sketch running under Processing 1.0.9. The behaviour, however, is broken, and I suspect it has something to do with the notes for Traer Physics relating to what was previously the kill() method:
  • The library no longer automatically deletes forces with dead particles.
  • void removeParticle( int index )
    void removeParticle( Particle p )

    Note removing things shifts the indices and the library does not take responsibility for you deleting particles that forces refer to. e.g. if you have a spring between two particles and remove one things will definitely break.

Eye for an Eye is a complex example demonstrating a complex idea using a custom library. The drawing done (which is beautiful) is not by any means simple, and some of the details require an understanding of properties of objects in the custom genetic algorithm library. It has virtually no code comments and would require significant expertise to understand.

This is not an example for a beginner to learn from.

The main page for the Genetic Algorithm Library for Processing or Java at the RobotAcid site tells you how to contact the author:

Quote:
If you put together any work using the GA library Just drop me a line and I'll be happy to link to it here. Same goes for if you find any bugs, typos or just simply don't understand how this library works. Contact me at the Processing forums (st33d) or email me
{ see site for details }

-spxl
Re: Help with modifying older code
Reply #3 - Feb 12th, 2010, 3:25am
 
Updated sketch: Eye for an Eye

Update by subpixel for:
- Processing 1.0
- Traer Physics 3.0
- Genetic Algorithm Library (as at 2010-02-12)

See source code for changes

Original sketch by Aaron Steed: Eye for an Eye

-spxl
Re: Help with modifying older code
Reply #4 - Feb 12th, 2010, 4:19am
 
I've uploaded an archive with the old physics library in it and some separate GA code. I found it whilst rooting around for a version that might work as a stand alone.

Sorry about the hassle getting this stuff to run, I've been a busy boy.
Page Index Toggle Pages: 1