How far can I push #!/bin/bash? Sudoku a'la BASH

Discussion in 'Programming/Scripts' started by thisiszeev, Aug 4, 2022.

  1. thisiszeev

    thisiszeev Member

    I have been working on this project for about 6 weeks now... I have taken a break because now I think I have reached a point that it is no longer pushing BASH but rather I am pushing my braincells to a point of a labor strike...:eek:

    I love puzzles. I see patterns in everything. I am the kind of guy who looks at a vehicle number plate and does random math using the numbers in the number plate. One of my favourite puzzles to do is Sudoku. The harder, the better.

    So I thought, could I use bash to generate puzzles for me?

    I crunched the numbers, and yes, generating a 9x9 puzzle in bash is rather easy... OK! What about 100x100 puzzle? Infact, what if I could do 9x9, 16x16, 25x25... oh you get the idea. One set of code, in BASH, to rule them all.

    $ ./

    Well, I started my pet project, and after a while I learned that using the same process as a 9x9, increases the probability of a impossible puzzle. In other words, a puzzle that will fail to generate due to the laws of sudoku physics being broken. So I kept going back to the drawing board.

    I have now designed an entirely new algorithm for sudoku, that when the puzzle is 9x9, follows the original rules, but as the puzzle get's bigger adds more initial structure to how it builds the puzzle. My whiteboard, full of ink, I worked out that a 100x100 puzzle will now have a 2% chance of failing to generate. Much better than the 50+% I was having.

    I do plan to publish this to my Git, and will post an update here when I do have a working product.

    So... who's interested?:cool:
    Th0m likes this.
  2. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    I'll surely check it out when you have published it.

Share This Page