Skip to content

OriginalStefikO/svelte-puzzle-8

Repository files navigation

Svelte Puzzle 8 (1Q2024)

Note

School project made in the last year of High School

About

For this project I'm using SvelteKit as frontend and FastAPI as backend. The goal is to create a solver for the puzzle 8 game. The solver uses A* algorithm to solve the puzzle.

About puzzle 8

The game is simple, you have a 3x3 grid with 8 tiles and one empty space. You can move the tiles to the empty space and the goal is to get the tiles in order from 1 to 8 (Or any other configuration of your liking).

About A* algorithm

A* is a graph traversal and path search algorithm, which is often used in many fields of computer science due to its completeness, optimality, and optimal efficiency.

I'm not going to talk about the complexity and how it works, there are many great articles about it, for example this one, where there is more then enough information about it.

alt text

Technologies used

The project is initiated from my FastAPI + Svelte starter where you can learn more about the project structure.

Requirements:

Docker

docker build -t base:latest .
docker-compose up -d 

How to run

  1. Clone this repository
git clone https://github.com/OriginalStefikO/svelte-puzzle-8.git .
  1. If you want to run it locally, run setup script, otherwise build docker image and skip everything else
npm run setup-project
# This will create virtual environment, install python dependencies and install all npm dependencies
docker build -t svelte-puzzle-8 .
docker run -p 8080:8080 svelte-puzzle-8
  1. If running locally, you can choose to run it in development mode, production mode or just build all and run
npm run frontend-dev
# This will run frontend in development mode

npm run backend-dev
# This will run backend in development mode

npm run build-and-run
# This will build frontend, backend and run it

If you like it you can give me a star ⭐, check out my profile and other projects

Or you can buy me a coffee, a lot of it was sacrificed for this project :D

Buy Me A Coffee

License

Svelte Puzzle 8 solver by Ondřej Šteffan is licensed under CC BY 4.0