-
-
Save jezinka/fcb24833ba4eedbf545cdb8a2efcba8b 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
| Cell[] getRecord(int rowNum) { return board[rowNum] } | |
| Cell[] getColumn(int colNum) { return (0..<board.length).collect { board[it][colNum] } } | |
| Cell[] getSquare(int rowNum, int colNum) { | |
| int beginRow = rowNum - rowNum % 3 | |
| int beginColumn = colNum - colNum % 3 | |
| return (beginRow..<beginRow + 3).collect { row -> | |
| (beginColumn..<beginColumn + 3).collect { column -> | |
| board[row][column] | |
| } | |
| }.flatten() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment