Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
let evaluateProximity(actor: Actor, pos:WorldPos, weight: float): float =
if actor.IsActive then
getDistance(actor.Pos, pos) * weight
let evaluateTile(brain: ActorChromosome, world: World, pos: WorldPos, random: System.Random): float =
evaluateProximity(world.Squirrel, pos, brain.squirrelImportance) +
evaluateProximity(world.Rabbit, pos, brain.rabbitImportance) +
evaluateProximity(world.Doggo, pos, brain.dogImportance) +
evaluateProximity(world.Acorn, pos, brain.acornImportance) +
evaluateProximity(world.Tree, pos, brain.treeImportance) +
(random.NextDouble() * brain.randomImportance)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment