Skip to content

Instantly share code, notes, and snippets.

@fzf
Last active February 11, 2020 18:15
Show Gist options
  • Save fzf/8fc759ce89ed7898531b5ce7a76b5af2 to your computer and use it in GitHub Desktop.
Save fzf/8fc759ce89ed7898531b5ce7a76b5af2 to your computer and use it in GitHub Desktop.
VALID_BOARD = [
[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]
]
INVALID_ROW_BOARD = [
[1,1,1, 1,1,1, 1,1,1],
[2,2,2, 2,2,2, 2,2,2],
[3,3,3, 3,3,3, 3,3,3],
[4,4,4, 4,4,4, 4,4,4],
[5,5,5, 5,5,5, 5,5,5],
[6,6,6, 6,6,6, 6,6,6],
[7,7,7, 7,7,7, 7,7,7],
[8,8,8, 8,8,8, 8,8,8],
[9,9,9, 9,9,9, 9,9,9],
]
INVALID_COL_BOARD = [
[1,2,3, 4,5,6, 7,8,9],
[1,2,3, 4,5,6, 7,8,9],
[1,2,3, 4,5,6, 7,8,9],
[1,2,3, 4,5,6, 7,8,9],
[1,2,3, 4,5,6, 7,8,9],
[1,2,3, 4,5,6, 7,8,9],
[1,2,3, 4,5,6, 7,8,9],
[1,2,3, 4,5,6, 7,8,9],
[1,2,3, 4,5,6, 7,8,9]
]
INVALID_BOX_BOARD = [
[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],
[3,4,5, 6,7,8, 9,1,2],
[8,9,1, 2,3,4, 5,6,7],
[6,7,8, 9,1,2, 3,4,5],
[9,1,2, 3,4,5, 6,7,8]
]
# Every row, column and box must include the numbers 1-9
# Row
[
[1,2,3,4,5,6,7,8,9]
...
]
# Column
[
[1...]
[2...]
[3...]
[4...]
[5...]
[6...]
[7...]
[8...]
[9...]
]
#Box
[
[123|...|...]
[456|...|...]
[789|...|...]
-------------
[...|...|...]
[...|...|...]
[...|...|...]
-------------
[...|...|...]
[...|...|...]
[...|...|...]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment