Last active
February 17, 2021 17:31
-
-
Save dsasse07/10869560d2e4c0538134733e7b24546f to your computer and use it in GitHub Desktop.
Sudoku safe placement row condition in JS
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
// puzzleArray is the game board being solved. A 9x9 matrix | |
// emptyCell = {rowIndex: INT , colIndex: INT } INT = coordinates of currently empty cell | |
// num = integer value 1-9 being tested | |
const rowSafe = (puzzleArray, emptyCell, num) => { | |
// -1 is return value of .find() if value not found | |
return puzzleArray[ emptyCell.rowIndex ].indexOf(num) == -1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment