DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,155 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
1Blademaster
1Blademaster

Posted on

Creating a Sudoku Solver and Generator with Python

Introduction

I recently created a 3-part tutorial on medium on how to create a sudoku engine which was capable of solving and generating sudoku's. A sudoku which has been generated can also be saved as a string, this makes it easier for the exportation of sudoku's. Bear in mind that the algorithms I show you in the tutorial are very greedy since a lot of recursion is used. Here is a link to the Github repo as well if you wanted to browse through the code.

Since this is a 3-part series, I've added links to all the 3 parts below:

  1. Introduction and creation of the solver
  2. Starting the generator 1
  3. Finishing the generator 2

Example Usage

You can use the tutorial to create a Board class which can further be imported into any of your scripts/programs as shown:

Final Thoughts

If you have any suggestions, advice or questions then please feel free to leave a comment and I shall answer everything.

Thank you for reading! πŸ’–

Oldest comments (0)

Let's Get Hacking

Join the DEV x MongoDB Atlas Hackathon 2022 and use your ingenuity and creativity to build an application using MongoDB's cloud based developer data platform, MongoDB Atlas.

β†’ Join the Hackathon