Skip to content

Instantly share code, notes, and snippets.

Created October 6, 2019 03:16
What would you like to do?
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment