Skip to content

Commit

Permalink
Fix indentation warnings in Genetic algo (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-brandewinder authored Jun 26, 2023
1 parent 13a28de commit 50f261e
Showing 1 changed file with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,44 @@ module Simulator =

let handleDogMove state otherActor =
if otherActor.ActorKind = Rabbit then
{
state with World = {world with
Rabbit = {world.Rabbit with IsActive = false}
Doggo = {world.Doggo with Pos = pos}
}}
{ state with
World =
{ world with
Rabbit = { world.Rabbit with IsActive = false }
Doggo = { world.Doggo with Pos = pos }
}
}
else
{
state with SimState = SimulationState.Lost; World = {world with
Squirrel = {world.Squirrel with IsActive = false}
Doggo = {world.Doggo with Pos = pos}
}}
{ state with
SimState = SimulationState.Lost
World =
{ world with
Squirrel = { world.Squirrel with IsActive = false }
Doggo = { world.Doggo with Pos = pos }
}
}

let handleSquirrelMove otherActor hasAcorn =
if not hasAcorn && otherActor.ActorKind = Acorn && otherActor.IsActive then
// Moving to the acorn for the first time should give the squirrel the acorn
{state with World =
{
world with
Squirrel = {ActorKind = Squirrel true; Pos = pos; IsActive = true}
Acorn = {world.Acorn with IsActive = false}
}
{ state with
World =
{
world with
Squirrel = { ActorKind = Squirrel true; Pos = pos; IsActive = true }
Acorn = { world.Acorn with IsActive = false }
}
}
else if hasAcorn && otherActor.ActorKind = Tree then
// Moving to the tree with the acorn - this should win the game
{
state with SimState = SimulationState.Won; World = {
world with Squirrel = {ActorKind = Squirrel true; Pos = pos; IsActive = true}
}
state with
SimState = SimulationState.Won
World =
{
world with
Squirrel = { ActorKind = Squirrel true; Pos = pos; IsActive = true }
}
}
else
performMove
Expand Down

0 comments on commit 50f261e

Please sign in to comment.