Wednesday, November 13, 2024

Sudo Moment

Was thinking, last night, quantum computers might well be great 

at solving Sudoku problems. Starting small, with a 3x3 board using

the numbers 1, 2, and 3.


The next move always involves checking both row and column (un)compatibility

but some moves are easier then others. One can ask what number to put

in each slot, but the better question is where to put the next '1'...

                                                 

*     *     *

This morning, asked Copilot to give me python code that would generate a 3x3

Sudo. Got back this code! To my utter surprise, it generates a complete Sudoku

Board.
                                 

                                                                      





*     *     *

 Yes, most Sudoku games that you play, whether online or in apps, are computer-generated. Here's how it typically works:


1. Puzzle Generation: Algorithms are used to create a complete Sudoku grid that follows the rules of the game. This involves filling a 9x9 grid with numbers 1 through 9 in such a way that each number appears exactly once in each row, column, and 3x3 subgrid.


2. Puzzle Difficulty: Once a complete grid is generated, the algorithm removes numbers from the grid to create the puzzle. The difficulty of the puzzle is determined by how many numbers are removed and the techniques required to solve it. Easier puzzles have more numbers filled in, while harder puzzles have fewer numbers and require more advanced solving techniques.


3. Validation: The generated puzzle is then validated to ensure it has a unique solution. This is important because a well-formed Sudoku puzzle should have only one possible solution.


4. Distribution: The validated puzzles are then distributed through various platforms, such as websites, mobile apps, and printed publications.


Computer-generated Sudoku puzzles ensure a wide variety of puzzles with different difficulty levels, providing endless entertainment for Sudoku enthusiasts. If you have any more questions or need further clarification, feel free to ask!

                                                                 *     *     *

        The code below creates a completed sudoku board. It does take some attention to follow

what happens, in what order. i am on JupyterNotebook, which I intalled with Anaconda, so

Python is already installed. I need to import random, which is a non-standard Python module.

I have used it before, so it was already on my machine. Just needed to import ot he project.


These is a series of define functions, at the onset. These are subroutines, that only run when

they are invoqued. Python is an interpreted language, read one line at a time as opposed to a 

compiled language which is in machine language as a whole before anything is run.  


So the program begins with the first line of independent code. There are also

implicitly defined iterations in the shuffle and pattern functions...                                                            



                                                                    



*     *     *

Live and learn; that clever 3x3 grid I created fot myself has been part of Mathematics

since 1700. It is known as a Latin Square, and is credited to Euler...





No comments: