Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created October 6, 2019 03:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save IntegerMan/2f29e6935a9a97c3c0f49c21758f8ea9 to your computer and use it in GitHub Desktop.
module MattEland.FSharpGeneticAlgorithm.Logic.WorldPos
type WorldPos = {X: int32; Y:int32}
let newPos x y = {X = x; Y = y}
let isAdjacentTo (posA: WorldPos) (posB: WorldPos): bool =
let xDiff = abs (posA.X - posB.X)
let yDiff = abs (posA.Y - posB.Y)
let result = xDiff <= 1 && yDiff <= 1
result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment