Skip to content

Instantly share code, notes, and snippets.

@BeauNouvelle
Created August 6, 2018 02:09
Show Gist options
  • Save BeauNouvelle/b9ee9b6f23e4850158a050e19d8cc281 to your computer and use it in GitHub Desktop.
Save BeauNouvelle/b9ee9b6f23e4850158a050e19d8cc281 to your computer and use it in GitHub Desktop.
public func isNeighbor(to cell: Cell) -> Bool {
let xDelta = abs(self.x - cell.x)
let yDelta = abs(self.y - cell.y)
switch (xDelta, yDelta) {
case (1, 1), (0, 1), (1, 0):
return true
default:
return false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment