# File: main.py # Author: Shawn Wilkinson # Global Imports import time # My Imports import FileHelper # Welcome Message print("Welcome to Sudoku-Solver.") # -- Main -- # Create two 9 x 9 Boards board = FileHelper.BoardFromFile('board.txt') # Fill from File hints = [['' for col in range(9)] for row in range(9)] # Fill Hints on Empty Spaces for x in range(9): for y in range(9): if board[x][y] == 0: hints[x][y] = '123456789' # Infinite Solving Loop while 1: # Eliminate Horizontal Hint Duplicates for x in range(9): # Create an Empty List list = [] # Get Values for That Row and Add to List for y in range(9):
return tmpStr # ---------------------- # ----- Accessors ----- # ---------------------- def getBoard(self): """Return the board array""" return self.boardArr # Self Testing and Debugging if __name__ == '__main__': # Create a Board from File print("Creating a Board...") board = Board( FileHelper.BoardFromFile('board.txt') ) # Print Initial Board print("Initial Board...") print( str(board) + "\n\n" ) # Main Operation - Quick Solve numEmpty = 10000 # Random High Value to Insure One Loop # If there are less empty spaces then before then loop again # if not then proceed with conflict resolution #while numEmpty > board.numEmpty(): # numEmpty = board.numEmpty() # board.horizontalSolve() # board.verticalSolve() # Print Quicksolved Board