I have a list of x number of lists compound by 2 elements: a class and a distance. I want to sort these lists regarding the distance. As far as I know, sort() only affects a list of individual variables, not lists. Besides that I have no clue what to try now.
The list that contains all the others is the one called "allData". The "eachFood" arraylists are inside the former.
Im trying to simulate the behavior of the unicellular organism Slime Mould. This organism looks for sources of food and other slime cells. Each has a domain of vision that depends on a determined angle and depth of vision. If a food source is sensed, it moves towards the food. If no food is seen but other cells, moves towards the geometric center of them. If no food nor cells are seen, it follows the same movement.
My script is not working because I dont know how to script a certain part. Once a cell has found food, how can I make them look for other sources of food? They get stuck and I don't know what else to try, I'm quite desperate.
Any advice is welcome. Thanks in advance!
CLASS SLIME CELL
class SlimeCell {
int visionExtend;
int visionAngle;
PVector location;
PVector direction;
SlimeCell [] allCells;
ArrayList neighbors;
Food [] allFood;
ArrayList food;
boolean isOutside;
SlimeCell() {
location = new PVector(random(width), random(height));
direction = new PVector(random(-1, 1), random(-1, 1));