Skip to content

Conversation

@seeing-hands
Copy link

This change is designed to generate fresh random seeds whenever a Sudoku object is instantiated. In the original version, if a seed is not explicitly provided, it is generated at import time instead of at instantiation time. This means that repeated calls to the constructor without a seed generate the same board like this:

>>> import sudoku
>>> b1 = sudoku.Sudoku(3, 3)
>>> b2 = sudoku.Sudoku(3, 3)
>>> b1.board == b2.board
True
>>> s1 = sudoku.Sudoku(3, 3).solve()
>>> b1.solve().board == s1.board
True

This modification generates a fresh seed every time the constructor is called if the user does not provide their own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant