Skip to content

Alvi24-hub/Sudoku-Solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sudoku Solver in C


This project is a simple and efficient Sudoku solver built using the C programming language. It uses backtracking to solve any 9x9 Sudoku puzzle that follows the classic rules.


Features

  • Takes Sudoku input directly from the user
  • Prints the original and solved grid in a clean 3×3 format
  • Validates rows, columns, and 3×3 boxes
  • Uses recursion and backtracking to find the solution
  • Displays a message if the puzzle is unsolvable

How It Works

  • Empty cells are filled one by one.
  • For each empty cell, it tries numbers from 1 to 9.
  • After placing a number, it checks if the move is valid.
  • If valid, it moves to the next empty cell.
  • If no number fits, it backtracks and tries a different number.
  • The process repeats until the puzzle is solved or declared unsolvable.

Example Output

alt text


Additional Features I Plan On Adding

  • Timer to show time taken to solve the puzzle
  • Difficulty validator to check if the input puzzle has a unique solution
  • Highlight prefilled or solved cells.
  • Build a windowed or terminal-based interface
  • Generate valid puzzles with varying difficulty

Requirements

  • GCC Compiler (v9+)
  • C Standard (C99 or above)
  • OS (Windows, Linux, Mac)
  • On Windows: Install MinGW-w64 or use WSL with GCC.
  • On Linux/macOS: GCC is usually pre-installed or available via package manager.

About

This is a simple yet powerful Sudoku Solver implemented in C using backtracking. The program takes an incomplete 9x9 Sudoku puzzle as input (with 0 representing blank cells) and fills it with a valid solution if one exists.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages