Refactor sudoku.py and implement generate sudoku