Created
August 6, 2018 02:09
-
-
Save BeauNouvelle/b9ee9b6f23e4850158a050e19d8cc281 to your computer and use it in GitHub Desktop.
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
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