Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Last active November 4, 2019 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IntegerMan/2db33c960ccc0639035e3d97b67a123b to your computer and use it in GitHub Desktop.
Save IntegerMan/2db33c960ccc0639035e3d97b67a123b to your computer and use it in GitHub Desktop.
let handleChromosomeMove (state: GameState, random: System.Random, chromosome: ActorChromosome) =
if state.SimState = SimulationState.Simulating then
let current = state.World.Squirrel.Pos
let movedPos = getCandidates(current, state.World, true)
|> Seq.sortBy(fun pos -> evaluateTile(chromosome, state.World, pos, random))
|> Seq.head
let newState = moveActor state state.World.Squirrel movedPos
simulateActors(newState, random.Next)
else
state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment