https://github.com/faizanf33/15-puzzle-game
Greedy Algorithm (AI)
https://github.com/faizanf33/15-puzzle-game
15-puzzle 15-puzzle-solver 15puzzle console-game greedy-algorithm greedy-algorithms python
Last synced: 9 months ago
JSON representation
Greedy Algorithm (AI)
- Host: GitHub
- URL: https://github.com/faizanf33/15-puzzle-game
- Owner: Faizanf33
- Created: 2020-04-19T14:51:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-19T15:28:39.000Z (over 5 years ago)
- Last Synced: 2025-01-03T22:34:40.285Z (11 months ago)
- Topics: 15-puzzle, 15-puzzle-solver, 15puzzle, console-game, greedy-algorithm, greedy-algorithms, python
- Language: Python
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 15-Puzzle-Game (Greedy Approach)
_______________________________
- *Accidental implementation* (Expected was heuristic approach)
- Simple logic/no big deal.
> How it works:
> 1. Given an array(1-D) as initial state **(Must be of len=16)**.
> 2. Check whether goal state is reachable.
> 3. Find the position of empty **None** block.
> 4. Enlist possible moves.
> 5. Find the cost of each move.
> 6. Apply move with the minimum cost.
> 7. Repeat 4,5,6 until goal state is found.
### Why algorithm fails for fairly complicated/large problems.
- Algorithm moves on the basis of current possible moves (no track/record).
- Moves with no/same minimum cost ends to repetition.
- Repetition is somehow solved using randomness but complicates the problem.