Skip to content

This is the sudoku solver. It uses CSP to solve the sudoku. The creators of this application have both never solved a sudoku, but with the power of CSP, we can solve any sudoku. Enjoy the application and have fun solving Sudokus.

License

SverreNystad/constraint-satisfaction-problem

Repository files navigation

Constraint Satisfaction Problems

Workflow Status (with event) codecov.io GPT-dungeon-master top language GitHub language count Project Version

Table of Contents
  1. Constraint Satisfaction Problems
  2. Introduction
  3. Installation
  4. Usage
  5. Tests
  6. License

Introduction

This is the sudoku solver. It uses CSP to solve the sudoku. The creators of this application have both never solved a sudoku, but with the power of CSP, we can solve any sudoku. Enjoy the application and have fun solving Sudokus.

The application is built with Flask and pure javascript. The CSP is implemented in python. The CSP is a backtracking algorithm. To learn more about CSP look here CSP and our Assignment. To implement the CSP was part of an assignment in the course TDT4136 Introduction to Artificial Intelligence at NTNU.

Picture of the application:

frontend

Installation

To install the Sudoku solver, one needs to have all the prerequisites installed, clone the repository, and install all dependencies. The following sections will guide you through the process.

Prerequisites

Clone the repository

git clone https://github.com/SverreNystad/constraint-satisfaction-problem.git
cd constraint-satisfaction-problem

Virtual Environment (Recommended)

🚀 A better way to set up repositories

A virtual environment in Python is a self-contained directory that contains a Python installation for a particular version of Python, plus a number of additional packages. Using a virtual environment for your project ensures that the project's dependencies are isolated from the system-wide Python and other Python projects. This is especially useful when working on multiple projects with differing dependencies, as it prevents potential conflicts between packages and allows for easy management of requirements.

  1. To set up and use a virtual environment for Sudoku solver: First, install the virtualenv package using pip. This tool helps create isolated Python environments.

    pip install virtualenv
  2. Create virtual environment Next, create a new virtual environment in the project directory. This environment is a directory containing a complete Python environment (interpreter and other necessary files).

    python -m venv venv
  3. Activate virtual environment To activate the environment, run the following command:

    • For windows:

      source ./venv/Scripts/activate
    • For Linux / MacOS:

      source venv/bin/activate

Install dependencies

With the virtual environment activated, install the project dependencies:

pip install -r requirements.txt

The requirements.txt file contains a list of packages necessary to run Sudoku solver. Installing them in an activated virtual environment ensures they are available to the project without affecting other Python projects or system settings.

Usage

There are two usages of this application. The first one is to use the application as a web application. The second one is to use the application as a python library.

  1. To use the application as a web application, you need to run the following commands:
cd src
flask run
  1. To use the application as a python library, you need to run the following commands:
python main.py

Tests

To run all the tests, run the following command in the root directory of the project:

pytest

License

Licensed under the MIT License. Because this is a template repository, you need to change the license if you want to use it for your own project.

Contributors

I would like to thank Simon Sandvik Lee, you are the best!


Sverre Nystad
Simon Sandvik Lee
Simon Sandvik Lee

Acknowledgements

We would like to thank the following people for their contributions to this project. With their work on the CSP base code, we were able to create this application.

  • Original code by Håkon Måløy
  • Updated by Xavier Sánchez Díaz

About

This is the sudoku solver. It uses CSP to solve the sudoku. The creators of this application have both never solved a sudoku, but with the power of CSP, we can solve any sudoku. Enjoy the application and have fun solving Sudokus.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published