cross-posted from: https://lemmy.world/post/1027203

cross-posted from: https://lemmy.world/post/961924

A script in bash in combination with a script in C can help you solve a sudoku puzzle in a png file.

https://gitlab.com/christosangel/sudoku-solver-ocr

You can see the script in action in this video.

The main dependency is tesseract OCR, responsible for the oprical character recognition.

Another important dependency is imagemagick, responsible for the necessary image manipulation.

The file selection of the png image is done with zenity.

Feel free to give your feedback.

  • qwop@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Nice project! What approach to solving the sudoku did you use, is it a backtracking algorithm?

    Having a look at the code it looks like there’s quite a lot of repetition that could probably be refactored to be a bit cleaner!

    • christos@lemmy.worldOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Thank you!

      The script is brute forcing its way through possible solutions of 3x3 squares,AND lines AND columns, util it finds a match (there can be moree than one).

      The code is admittedly quite “dirty”, lots of repetition and nested conditionals.

      It was one of my first project in (self-taught) C, and it was a great lesson in pointers. It sure can be improved, in due time I suppose.

      Again, thanks for the kind words and the feedback!