Giter Club home page Giter Club logo

sudoku_solver's Introduction

About this project

This sudoku solver uses brute force, or exhaustive search, in order to find the solution for the puzzle.

It locates the first empty square, and inserts the first possible number from 1-9 on it. It repeats the process until it finds a square where no numbers fit. When that happens, it goes back, adds one to the last mutable square, and repeats the process until the board is filled.

In computer science, brute-force search or exhaustive search, also known as generate and test, is a very general problem-solving technique and algorithmic paradigm that consists of systematically checking all possible candidates for whether or not each candidate satisfies the problem's statement.

Please contact me if you find a board it cannot solve, or any other issue.

Instructions

  • Git Clone this repo;

  • Run the program by using one of the following options:

    • make run will make it go at it's default speed;
    • make slow will make it go slower;
    • make fast will make it to go faster;
    • There is also a fourth and the fastest option, make now. My program uses the usleep function in order to make the printing visible on the screen, and the make now option sets that value to zero.
  • Follow the instructions displayed to insert values into your board;

  • Watch it go as it solves your puzzle! ๐Ÿ›น

Keep in mind that as this is an exhaustive search algorithm, some puzzles might take a while (hours maybe), even if you selected make now.

Running

Here it is in action:

Regarding impossible boards

It will crash on impossible boards, like for example this one:

There is no place for a 1 in the third square, as the only possible location for it is already occupied with a 5.

The program will still try to solve it, eventually stating the board is impossible as it tries every possible combination.


LinkedIn: https://www.linkedin.com/in/pedrosmpm

sudoku_solver's People

Contributors

peterbikes avatar

Stargazers

Gabrielatr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.