Skip to content

Instantly share code, notes, and snippets.

@iamkevinlowe
Created November 7, 2018 17:33
Show Gist options
  • Save iamkevinlowe/158d6f543487a067d350d5b91c2e6700 to your computer and use it in GitHub Desktop.
Save iamkevinlowe/158d6f543487a067d350d5b91c2e6700 to your computer and use it in GitHub Desktop.
// Create a function to test if these sudoku puzzles are correct
// correct
[
[1,2,3,4,5,6,7,8,9],[4,5,6,7,8,9,1,2,3],[7,8,9,1,2,3,4,5,6],
[2,3,4,5,6,7,8,9,1],[5,6,7,8,9,1,2,3,4],[8,9,1,2,3,4,5,6,7],
[3,4,5,6,7,8,9,1,2],[6,7,8,9,1,2,3,4,5],[9,1,2,3,4,5,6,7,8]
],
// incorrect, 5 twice in block 5
[
[1,2,3,4,5,6,7,8,9],[4,5,6,7,8,9,1,2,3],[7,8,9,1,2,3,4,5,6],
[2,3,4,5,6,7,8,9,1],[5,6,7,8,9,1,2,3,5],[8,9,1,2,3,4,5,6,7],
[3,4,5,6,7,8,9,1,2],[6,7,8,9,1,2,3,4,5],[9,1,2,3,4,5,6,7,8]
],
// incorrect, numbers in block 5 shifted by 2 places
[
[1,2,3,4,5,6,7,8,9],[4,5,6,7,8,9,1,2,3],[7,8,9,1,2,3,4,5,6],
[2,3,4,5,6,7,8,9,1],[7,8,9,1,2,3,4,5,6],[8,9,1,2,3,4,5,6,7],
[3,4,5,6,7,8,9,1,2],[6,7,8,9,1,2,3,4,5],[9,1,2,3,4,5,6,7,8]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment