class creature { genome genotype; int minGenes=4; int maxGenes=25; int maxRepeat=4; int maxNodes=1000; int amount=int(random(minGenes,maxGenes)); position rootNode; lattice phenotype; int nodeAmount=0; position lastP; position p; float distanceTravelled=0; creature(position startPos) { rootNode=new position(startPos); genotype=new genome(amount,this); phenotype=new lattice(nodeAmount,this); buildCreature(rootNode,phenotype,genotype,maxNodes); phenotype.update(); p=new position(phenotype.averagePos); lastP=new position(p); distanceTravelled=0; } void update(position l) { lastP=new position(p); phenotype.update(l); p=new position(phenotype.averagePos); } boolean checkStability() { return phenotype.stable; } float currentSize() { return phenotype.mostDistant; } void export(String filename) { String list[]=split(genotype.strainKey); saveStrings(filename,list); } void rebuild() { phenotype=new lattice(nodeAmount,this); buildCreature(rootNode,phenotype,genotype,maxNodes); phenotype.update(); p=phenotype.averagePos; lastP=new position(p); distanceTravelled=0; } void mutate() { genotype.mutate(); } }