void buildCreature(lattice phen,genome gen) { constructPhenome(phen,gen); if(useMirror) mirror(phen); buildNeurons(phen); buildMuscles(phen); } void constructPhenome(lattice phen,genome gen) { float cellDistance=18; position curPos=new position(rootNode); phen.addNode(curPos,gen.strain[0]); constructChild(phen,phen.nodes[0],curPos); } void constructChild(lattice phen,cell curCell,position curPos) { 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); } if(curCell.g.child!=null&&phen.nodes.length0) { phen.addNode(curPos,curCell.g); constructRepeat(phen,curCell,curPos.displace(curCell.g.heading,17),repeat); } 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); } return; } void mirror(lattice phen) { int numNodes=phen.nodes.length; for(int i=1;i