Sunday, 27 February 2022

Creating a Book of Sudoku Puzzles

I started looking into this some time ago.

At first I tried pasting images into a document on my Google drive. After I had added 21 puzzles with their corresponding solutions, I realised this was going to take far too long so I decided to automate the process.

In puzzle 641 I showed how I could use Python to create a PDF containing a sudoku puzzle and its solution.

The next step was to make a file of puzzles and solutions to use as input for this program. Using a simple Linux bash script I ran my sudoku creation C program in a loop and graded each puzzle it created using Hodoku. I left it running until it had written 100 easy puzzles into a file. You can see this file in the screen print below. Unfortunately the screen of the laptop I used was small so the lines wrapped round a bit but you should be able to get the idea of what I did:


At the start of each line is the puzzle number i.e. 1, 2, 3 etc.

Then there is a space. I'm not a Python expert (yet) but that space probably won't be necessary for the program I write to produce the PDF of 100 puzzles. I just added it to make this post easy to explain.

Then there is the puzzle, represented as 81 digits, followed by another space.

The solution comes next. It's on the same line in the file but it wraps round on the screen print.

I now just need to write the program which will render the puzzles in the book.

It may end up being two programs:

One program to create a PDF which I will give away for free with some advertising on each page. That depends on finding a suitable advertiser. Don't all rush at once.

Trying to sell a PDF is probably a waste of time as it will be plagiarized straight away. It seems that every day I receive an offer to download some free book about Cyber Security, Linux or Networking. These books typically contain high quality content so the idea that their authors intended to give them away for free seems absurd. It is far more likely that they were stolen and are being offered for nothing to build email lists or possibly to download malware.

Another program to create a PDF which will become a paperback to sell on Amazon. There are a couple of issues with this: There are thousands of sudoku books already so competition is high. Also, I don't have a publisher so the books will have to be printed on demand which will push the price up.

No comments:

Post a Comment