org.holtz.zoe
Class Bug

java.lang.Object
  extended by java.util.Observable
      extended by org.holtz.zoe.ZObject
          extended by org.holtz.zoe.Bug
All Implemented Interfaces:
ZoelVMHost

public class Bug
extends ZObject
implements ZoelVMHost

A Zoe organism controlled by Genes each executing on its own ZoelVM virtual machines.

Author:
Brian Holtz

Field Summary
 int age
           
 double diameter
           
 Bug father
           
 double gaze
          Gaze in radians relative to heading.
protected  Genotype genotype
           
 double heading
           
 Bug lastMate
           
 ZObject lastSensed
           
 Bug mother
           
 
Fields inherited from class org.holtz.zoe.ZObject
id, world
 
Constructor Summary
Bug(World theWorld)
           
Bug(World theWorld, Genotype theGenotype)
           
 
Method Summary
 void brownianMotion()
           
 boolean canSee(ZObject obj)
           
 java.awt.Color color()
           
 java.lang.String descendents()
           
 java.lang.String descendents(int[] descendents, java.lang.String separator)
           
 java.lang.String descendents(java.lang.String separator)
           
 java.lang.String descendentsCount()
           
 void disappear()
           
 ZoelVM.Turn execute(Operator operator, Literal operand)
           
 java.lang.String genealogy(int generations)
           
 java.lang.String genealogy(java.lang.String separator)
           
 Genotype genotype()
           
 Literal get(Literal key)
           
 Literal get(RegisterReference arg)
           
 int getNextId()
           
 int getNumEverCreated()
           
 int id()
           
 Expression implicitArgOf(Operator op)
          The implicit argument, if any, of an Operator.
 boolean isDead()
           
 double mass()
           
 int maxDataSize()
           
 int maxStepsPerTurn()
           
 void next()
           
 Bug nextChild(Bug currentChild)
           
 Bug nextDescendant(Bug currentDescendant)
           
 Bug nextDescendant(Bug currentDescendant, java.util.List<Bug> generation)
           
 Bug nextSibling()
           
static int numEverCreated()
           
 int numLivingDescendents()
           
 Literal put(Literal key, Literal value)
           
 java.util.Random random()
           
 double strength()
           
 double strengthRatio()
          The fraction of full strength at current size.
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String separator, boolean labels)
           
 java.lang.String tracePrefix()
           
 World world()
           
 Bug youngestChild()
           
 
Methods inherited from class org.holtz.zoe.ZObject
bearing, bearing, evaluate, getContext, isGone, location, move, range, range, repaint, setContext, setXY, x, y
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mother

public Bug mother

father

public Bug father

lastMate

public Bug lastMate

lastSensed

public ZObject lastSensed

genotype

protected Genotype genotype

age

public int age

diameter

public double diameter

heading

public double heading

gaze

public double gaze
Gaze in radians relative to heading.

Constructor Detail

Bug

public Bug(World theWorld)

Bug

public Bug(World theWorld,
           Genotype theGenotype)
Method Detail

brownianMotion

public void brownianMotion()
Overrides:
brownianMotion in class ZObject

mass

public double mass()
Specified by:
mass in class ZObject

strengthRatio

public double strengthRatio()
The fraction of full strength at current size.

Returns:
a double between 0 and 1.0.

strength

public double strength()

genotype

public Genotype genotype()

isDead

public boolean isDead()

disappear

public void disappear()

numLivingDescendents

public int numLivingDescendents()

canSee

public boolean canSee(ZObject obj)

implicitArgOf

public Expression implicitArgOf(Operator op)
Description copied from interface: ZoelVMHost
The implicit argument, if any, of an Operator.

Specified by:
implicitArgOf in interface ZoelVMHost
Parameters:
op - The Operator.
Returns:
A RegisterReference or Literal, or null if op has no implicit argument.

get

public Literal get(RegisterReference arg)
Specified by:
get in interface ZoelVMHost

get

public Literal get(Literal key)
Specified by:
get in interface ZoelVMHost

put

public Literal put(Literal key,
                   Literal value)
Specified by:
put in interface ZoelVMHost

execute

public ZoelVM.Turn execute(Operator operator,
                           Literal operand)
Specified by:
execute in interface ZoelVMHost

next

public void next()

nextDescendant

public Bug nextDescendant(Bug currentDescendant,
                          java.util.List<Bug> generation)

nextDescendant

public Bug nextDescendant(Bug currentDescendant)

nextChild

public Bug nextChild(Bug currentChild)

nextSibling

public Bug nextSibling()

youngestChild

public Bug youngestChild()

genealogy

public java.lang.String genealogy(java.lang.String separator)

genealogy

public java.lang.String genealogy(int generations)

descendents

public java.lang.String descendents()

descendents

public java.lang.String descendents(java.lang.String separator)

descendentsCount

public java.lang.String descendentsCount()

descendents

public java.lang.String descendents(int[] descendents,
                                    java.lang.String separator)

toString

public java.lang.String toString(java.lang.String separator,
                                 boolean labels)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getNextId

public int getNextId()
Specified by:
getNextId in class ZObject

getNumEverCreated

public int getNumEverCreated()
Specified by:
getNumEverCreated in class ZObject

random

public java.util.Random random()
Specified by:
random in interface ZoelVMHost

world

public World world()
Specified by:
world in interface ZoelVMHost

maxDataSize

public int maxDataSize()
Specified by:
maxDataSize in interface ZoelVMHost

maxStepsPerTurn

public int maxStepsPerTurn()
Specified by:
maxStepsPerTurn in interface ZoelVMHost

id

public int id()

numEverCreated

public static int numEverCreated()

color

public java.awt.Color color()
Specified by:
color in class ZObject

tracePrefix

public java.lang.String tracePrefix()
Specified by:
tracePrefix in interface ZoelVMHost