As was stated in the previous post in order for the program to work the reptiles population needed to be sustainable for a number of generations. There were many factors that could have been affecting this so a number of steps were taken.
A spreadsheet was made to get an overview of all of the variables and how they were working together, as in order to be have a population which could be sustained over a number of generations a balance needed to bed struck between the number of plants, the number of reptiles, the flow of energy and all the other affecting factors.
Firstly collision detection was implemented for the reptiles this simply involved overloading the function which detected collision with reptiles and took a plant node as an argument to take a reptile node as an argument. This would allow it to search through the reptile list and check for collision with every other reptile. The reptiles need to check that they are not looking at themselves when checking for collision as they are all in the same list.
It was found that one of the problems was the reptile population was not growing quick enough, this was partly because each reptile was currently only able to have one baby so it was made possible for them to breed a number of times in there lives with a gap after each time.
There were still errors remaining and this was now the main reason the population was growth was becoming stunted. There was the invisible plant which was trapping all the reptiles which was the main problem but also reptiles seemed to sometimes disappear . After much painstaking debugging it was found that some how the initialisation of the root of the plant list was no longer happening after the start population had been implemented. This was meaning it was not drawn with any size but had a position and this was what the reptiles were getting stuck on. The problem with them disappearing was that when a reptile went towards a plant of a different size than itself it would accelerate in the y direction and fly off, so when heading for food or mates the y part of the acceleration vector had to be zeroed.
With these errors fixed it just took some tweaking of the lifespans energy transfer etc… to get a population of reptiles which laste for a number of generations. The next task was to test some simple evolution and finish up the report for hand in.