https://github.com/vianpyro/8-puzzle_solver
Implementation of an 8-puzzle solver in C
https://github.com/vianpyro/8-puzzle_solver
8-puzzle 8-puzzle-solver c
Last synced: over 1 year ago
JSON representation
Implementation of an 8-puzzle solver in C
- Host: GitHub
- URL: https://github.com/vianpyro/8-puzzle_solver
- Owner: Vianpyro
- License: mit
- Created: 2024-09-07T21:41:51.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-09T23:55:40.000Z (over 1 year ago)
- Last Synced: 2025-03-10T00:25:33.279Z (over 1 year ago)
- Topics: 8-puzzle, 8-puzzle-solver, c
- Language: C
- Homepage:
- Size: 29.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 8-Puzzle Solver
This project is an implementation of an 8-puzzle solver in C.
## Table of Contents
- [Introduction](#introduction)
- [Getting Started](#getting-started)
- [Brute Force Approach](#brute-force-approach)
- [Usage](#usage)
- [Contributing](#contributing)
- [License](#license)
## Introduction
The 8-puzzle is a classic problem in computer science and artificial intelligence, where the goal is to move tiles on a 3x3 grid to achieve a desired end configuration. This repository contains an 8-puzzle solver.
## Getting Started
### Prerequisites
To compile and run this project, you need:
- A C compiler (e.g., `gcc`)
### Installation
Clone the repository:
```bash
git clone https://github.com/Vianpyro/8-Puzzle_Solver.git
cd 8-Puzzle_Solver
```
Build the project:
**GCC** (Linux/Windows):
```bash
gcc ./*.c ./solve/*.c -o 8-puzzle
```
**Clang** (macOS):
```bash
clang ./*.c ./solve/*.c -o 8-puzzle
```
**CMake** (Linux/Windows):
_Make sure [CMake file](CMakeLists.txt) is in the folder_
```bash
mkdir build
cd build
cmake ..
make
```
## Brute Force Approach
The brute force method explores all possible moves from a given configuration to find a solution. This approach is straightforward but may not be efficient for puzzles that are far from the solution.
- Exhaustive search of all possible configurations
- Guaranteed to find a solution (if one exists)
## Usage
Open a terminal and run the binary file.
## Contributing
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or new features.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.