This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | |
} | |
} | |
else if hasAcorn && otherActor.ActorKind = Tree then | |
// Moving to the tree with the acorn - this should win the game | |
{ | |
state with SimState = Won; World = { | |
world with Squirrel = {ActorKind = Squirrel true; Pos = pos; IsActive = true} | |
} | |
} | |
else | |
performMove |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment