An open API service indexing awesome lists of open source software.

https://github.com/nathancordeiro/sudoku-ninja

This project SUDOKU-NINJA is a command-line, optimized Sudoku solver and puzzle generator for the conventional 9x9 puzzles, developed in C++. It offers an engaging way for players to solve Sudoku puzzles directly from their terminal or command prompt.
https://github.com/nathancordeiro/sudoku-ninja

cpp sudoku terminal-game

Last synced: 6 months ago
JSON representation

This project SUDOKU-NINJA is a command-line, optimized Sudoku solver and puzzle generator for the conventional 9x9 puzzles, developed in C++. It offers an engaging way for players to solve Sudoku puzzles directly from their terminal or command prompt.

Awesome Lists containing this project

README

          

# SUDOKU-NINJA🥷

## Overview
This project, SUDOKU-NINJA, is a command-line application that combines an optimized Sudoku solver with a puzzle generator for conventional 9x9 puzzles, developed in C++🎮. It provides an engaging and interactive way for users to solve or play Sudoku puzzles directly from their terminal or command prompt. The game features several preset puzzles and a robust backtracking algorithm that demonstrates the solution process, making it perfect for both enthusiasts and learners🧩.

## What is Sudoku? For those living under a rock.
Sudoku is a popular logic-based number puzzle. The objective is to fill a 9x9 grid with numbers from 1 to 9, following these rules:

- Each row must contain all numbers from 1 to 9 without repetition.
- Each column must also contain all numbers from 1 to 9 without repetition.
- Each of the nine 3x3 sub-grids, called boxes, must contain all numbers from 1 to 9 without repetition.

The puzzle starts with some cells already filled with numbers, and the player must fill in the remaining cells. Sudoku puzzles range in difficulty from easy to extremely challenging.

## Features
Upon starting the game, you will be presented with the following menu options:

| Option | Description |
|-----------------------|---------------------------------------------------------------|
| **New Puzzle** | Load the next preset puzzle. |
| **Reset puzzle** | Reset the puzzle to its initial state. |
| **Solve Puzzle** | Solve the current puzzle using the backtracking algorithm. |
| **Enter Numbers** | Manually enter numbers into the puzzle grid. |
| **Quit** | Quit or exit the game. |

## Screenshot📸


Screenshot

## Prerequisitesâś…
- A C++ compiler🖥️
- Command-line interfaceđź’»

## Compilation
To compile the project, follow these steps:

1. Clone the repository:
```sh
git clone https://github.com/NathanCordeiro/SUDOKU-NINJA.git
```
2. Navigate to the directory containing the project files using the `cd` command.
```bash
cd SUDOKU-NINJA/Sudoku
```
3. Compile the project using the following command:
```bash
g++ -o Sudoku main.cpp manager.cpp solver.cpp
```
This will generate an executable file named Sudoku.exe on Windows or Sudoku on Unix-based systems.

## Running the Game
After compilation, you can run the game by executing the compiled file:
#### On Windows:
```bash
Sudoku.exe
```
`OR`

```bash
Sudoku
```

#### On Unix-based systems (Linux/macOS):
```bash
./Sudoku
```
## File Structure
| File | Description |
|-----------------------|---------------------------------------------------------------|
| **main.cpp** | Contains the main function and the primary game loop. |
| **manager.cpp** | Implements functions for handling the game menu, loading, resetting puzzles, and entering numbers. |
| **manager.h** | Header file declaring the functions used in `manager.cpp`. |
| **solver.cpp** | Implements the Sudoku solving algorithm. |
| **solver.h** | Header file declaring the functions used in `solver.cpp`. |
| **txt_styling.h** | Contains ANSI escape codes for text styling. |

```
SUDOKU-NINJA/
│
├── Images/
│ └── sudoku.png
│
├── Sudoku/
│ ├── main.cpp
│ ├── manager.cpp
│ ├── manager.h
│ ├── solver.cpp
│ ├── solver.h
│ ├── txt_styling.h
│ └── Sudoku.exe (generated after compilation)
│
├── LICENSE
├── README.md
└── .gitignore
```

## Customization
You can customize the preset puzzles in manager.cpp by modifying the presetPuzzles vector.

To change the default colors, update the color variables in the code directly🎨.

## Contribution
Contributions are welcome! Please fork the repository and create a pull request with your changes🚀.

## Contact
For questions or support, please contact me at nathanjohncordeiro@gmail.comđź“§.

## License
[![Licence](https://img.shields.io/github/license/Ileriayo/markdown-badges?style=for-the-badge)](./LICENSE)