void buildCreature(position p,lattice phen,genome gen,int maxNodes) { constructPhenome(p,phen,gen,maxNodes); if(useMirror) mirror(phen); buildNeurons(phen); buildMuscles(phen); } void constructPhenome(position p,lattice phen,genome gen,int maxNodes) { float cellDistance=18; position curPos=new position(p); phen.addNode(curPos,gen.strain[0]); constructChild(phen,phen.nodes[0],curPos,maxNodes); } void constructChild(lattice phen,cell curCell,position curPos,int maxNodes) { if(curCell.g.repeat>0) { int r=curCell.g.repeat; if(curCell.g.id==0&&curCell.g.repeat>0) r++; position repeatPos=new position(curPos.displace(curCell.g.heading,17)); constructRepeat(phen,curCell,repeatPos,r,maxNodes); } if(curCell.g.child!=null&&phen.nodes.length0) { phen.addNode(curPos,curCell.g); constructRepeat(phen,curCell,curPos.displace(curCell.g.heading,17),repeat,maxNodes); } if(curCell.g.child!=null&&phen.nodes.length0) { gene newGene=new gene(curCell.g.child); position childPos=new position(curPos.displace(curCell.g.child.heading,17)); phen.addNode(childPos,newGene); int cellID=phen.nodes.length-1; constructChild(phen,phen.nodes[cellID],childPos,maxNodes); } return; } void mirror(lattice phen) { int numNodes=phen.nodes.length; for(int i=1;i