Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created October 22, 2019 03:40
Embed
What would you like to do?
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