Created
August 6, 2018 02:14
-
-
Save BeauNouvelle/ffb50074c8e76aff1aba6b9dd49ddb81 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let firstCell = Cell(x: 10, y: 10, state: .dead) | |
let secondCell = Cell(x: 11, y: 10, state: .dead) | |
print(firstCell.isNeighbor(to: secondCell)) | |
// true - Same row, adjacent column. | |
let firstCell = Cell(x: 10, y: 10, state: .dead) | |
let secondCell = Cell(x: 20, y: 10, state: .dead) | |
print(firstCell.isNeighbor(to: secondCell)) | |
// false - Same row, vastly different column. | |
let firstCell = Cell(x: 10, y: 10, state: .dead) | |
let secondCell = Cell(x: 10, y: 10, state: .dead) | |
print(firstCell.isNeighbor(to: secondCell)) | |
// false - Same row, same column. They're identical cells! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment