com.caplet.manna
Class GAPainter

java.lang.Object
  |
  +--com.caplet.manna.GAPainter
All Implemented Interfaces:
java.lang.Runnable

public class GAPainter
extends java.lang.Object
implements java.lang.Runnable

Does the evolution, and displays the results, in a separate thread than the rest of the applet. One thread evolves both dishes, so their generations will be exactly in synch.

When evolution is paused, the GAPainter thread still exists, but is paused, waiting to be told to go. It starts paused.

Author:
Mark S. Miller, markm@caplet.com, Terry Stanley, tstanley@cocoon.com

Constructor Summary
GAPainter(GA[] gas)
          Give it the array of GAs it should evolve.
 
Method Summary
 void addManna(int cx, int cy, int amount)
          Add the same amount of manna at the same place in all GAs.
 void go()
          Let the evolution resume (or commence)
 void pause()
          Stop the world, I want to play god.
 void run()
          This is the "main"-like method for a Thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GAPainter

public GAPainter(GA[] gas)
Give it the array of GAs it should evolve.

Method Detail

run

public void run()
This is the "main"-like method for a Thread.

Specified by:
run in interface java.lang.Runnable

go

public void go()
Let the evolution resume (or commence)


pause

public void pause()
Stop the world, I want to play god.


addManna

public void addManna(int cx,
                     int cy,
                     int amount)
Add the same amount of manna at the same place in all GAs.