# Import sys to get the command line arguments import sys # To get the time so we can see how long things take import datetime # To be able to have the clicktoDoWhat function from tkinter import * # Import the file that contains the threeInARowBoard class # Since this contains a class, we are just importing the file # to be used as # board = threeInARowBoard.threeInARowBoard(n) import threeInARowBoard # Import the file that you completed. # Since you want access to all of the functions in this file, # we are importing everything from it, rather than importing the file #from threeInARowSolver import * from threeInARowSolverWorking import * # This will allow us to have a simple dialog window to pause, asking for click to do whatever def clickToDoWhatever(text:str): root = Tk() root.title(text) Button(root, text="Click to "+text, command=root.quit).pack() root.mainloop() root.destroy() def main(): # Create the board, which will ask the user what file to use as the initial board board = threeInARowBoard.threeInARowBoard() # If you want text printed here of what the board looks like, uncomment the following: #print("The initial board is") #print(board) # If you want it to be fast and now show the animation while updating, uncomment this line #board.updatingGraphics(False) # Uncomment the following line if you want to have it pause before it starts the solving process #input("Press enter when you are ready for it to go") clickToDoWhatever("start it running") # If we want to see how long things take, we will want to get the time startTime = datetime.datetime.now() # Print out the start time, if you want #print(f"Time to start looking for a solution at {startTime.time()}") # Now have it find a solution result = findSolution(board) # After we got the solution, get the time again and see what the difference is endTime = datetime.datetime.now() timeDiff = endTime-startTime # Print out how long it took, if you want print(f"We finished at {endTime.time()}\nThe elapsed time, (H:MM:SS.sss) was {timeDiff}") # Update the graphical board, just in case this was off and print the results board.updatingGraphics(True) if(result): print("The solution is:\n" + str(board)) else: print("We failed to find a solution for the board") # Pause to make sure people can see the results and after they press enter, close the window clickToDoWhatever("exit") board.close() if __name__ == "__main__": main()