I would like to understand a bit more the theory and the approaches available in modelling a population roaming across a landscape. Assume discrete time and space as simple as a discrete grid and a population of different creatures and plants being able to perform very simple actions such as move to a neighboring grid square or eat a neighboring plant (for animals), or expand to a neighboring grid square (for plants). This is inspired by the following JavaScript project which seems easy when you follow the narrative but when trying to model it on my own from scratch using my own abstractions I was frustrated.For instance a decision point I encountered was:should both the grid know where each thing (plant or animal) is located and the creatures themselves know where they are (in terms of x-y coordinates) or only one of the two ways. Holding this information in both places may simplify algorithms but then you have the possibility of corruption.I came up with the following very basic engine (pseudocode):while (world.containsAtLeastOneLivingThing()) {    listOfAllPlantsAndAnimals = world.allSurvivingThings();    var actions = [];    for (thing: listOfAllPlantsAndAnimals)        actions.push(thing.liveAnotherMoment()); // things like: move, eat, expand, die    var consolidatedActions = resolveConflicts(actions);    world.absorbChange(consolidatedActions);}I gave up on this attempt when I realized that the actions need to hold so much information (such as where on the grid the action occurred, which creatures/plants were involved, how to identify those creatures, by some ID or by their location on the grid), that in the end the above engine doesn't really succeed in breaking up the problem into manageable chunks as all the complexity ends up in the resolveConflicts function.I am not really interested in modelling efficiency but rather in clarity of algorithms and abstractions. Is there some broader body of theory that deals with the modelling of this subject-matter? Game programming perhaps? I am confident I could tackle this more easily in a strongly-typed language like Java; trying to code this in a language (JavaScript) that's both loosely-typed and also in which I have limited exposure (and so lack the ability to express concepts idiomatically) I am sure doesn't help.
modelling an ecosystem evolving on a landscape
javascript;simulation;games