|
1 | | -# Klotski Web |
| 1 | +# Klotski Web Game |
2 | 2 |
|
3 | | -Klotski game built with Spring Boot, Vue, and TailwindCSS. Saves are managed via authentication. |
| 3 | +A web-based implementation of the classic Klotski sliding block puzzle game. The game challenges players to move a special block to a specific position by strategically sliding other blocks out of the way, aiming to complete the puzzle in the minimum number of moves possible. |
4 | 4 |
|
5 | 5 | ## Features |
6 | | -- Classic Klotski puzzle |
7 | | -- User authentication |
8 | | -- Save/load games per user |
9 | | - |
10 | | -## Tech Stack |
11 | | -- **Backend:** Spring Boot |
12 | | -- **Frontend:** Vue, TailwindCSS |
13 | | -- **Database:** PostgreSQL (Docker Compose) |
14 | | - |
15 | | -## Setup |
16 | | -1. Clone the repository: |
17 | | - ```sh |
18 | | - git clone https://github.com/Fireentity/klotski-web.git |
19 | | - cd klotski-web |
20 | | -## Build and run with Docker: |
21 | | - docker-compose up |
22 | | - |
23 | | -## Access the game at http://localhost:8080 |
| 6 | + |
| 7 | +- User authentication system for game progress tracking |
| 8 | +- Multiple difficulty levels (Simple, Medium, Hard, Impossible) |
| 9 | +- Move counter to track puzzle solving progress |
| 10 | +- Game controls: |
| 11 | + - Reset button to restart the current puzzle |
| 12 | + - Undo button for reverting the last move |
| 13 | + - Hint system for assistance when stuck |
| 14 | +- History tracking of last 10 games with move counts and timestamps |
| 15 | +- Ability to start a new game at any time |
| 16 | + |
| 17 | +## Technical Stack |
| 18 | + |
| 19 | +### Backend |
| 20 | +- Java 17 |
| 21 | +- Spring Boot 3.0.2 |
| 22 | +- Gson 2.10.1 |
| 23 | +- Lombok 1.18.28 |
| 24 | +- JUnit |
| 25 | +- Gradle 7.6 |
| 26 | + |
| 27 | +### Frontend |
| 28 | +- TypeScript 5.0.4 |
| 29 | +- Vue 3.2.47 |
| 30 | +- Tailwind CSS 3.3.2 |
| 31 | +- Axios 1.3.6 |
| 32 | +- Vuex 4.1.0 |
| 33 | +- Vite 4.3.2 |
| 34 | +- Node.js 18.16.1 |
| 35 | + |
| 36 | +## Architecture |
| 37 | + |
| 38 | +The project follows a clear separation between frontend and backend, implementing the following design patterns: |
| 39 | +- Model-Controller (MC) architecture with API exposure |
| 40 | +- Visitor pattern for tile behavior management |
| 41 | +- Repository pattern for data persistence |
| 42 | +- Strategy pattern for movement validation and JSON serialization |
| 43 | + |
| 44 | +## Prerequisites |
| 45 | + |
| 46 | +- Docker |
| 47 | +- Amazon Corretto 17 (Amazon's distribution of OpenJDK 17) |
| 48 | +- WSL2 (required for Windows users) |
| 49 | +- IntelliJ IDEA (recommended IDE) |
| 50 | + |
| 51 | +## Installation & Setup |
| 52 | + |
| 53 | +1. Clone the repository from GitHub |
| 54 | +2. Open the project in IntelliJ IDEA |
| 55 | +3. Navigate to the `docker-compose.yml` file |
| 56 | +4. Start the frontend and database services by clicking the green play button on lines 4 and 18 respectively |
| 57 | + |
| 58 | +### Starting the Backend |
| 59 | + |
| 60 | +1. Open the Gradle tool window in IntelliJ IDEA |
| 61 | +2. Navigate to: `klotski-web/klotski-web/game-rest-api/Tasks/application` |
| 62 | +3. Double-click on the `bootRun` executable |
| 63 | + |
| 64 | +### Accessing the Application |
| 65 | + |
| 66 | +1. Click on "Services" at the bottom left of IntelliJ IDEA |
| 67 | +2. Select `klotski-web-frontend-1` |
| 68 | +3. The application URL will be displayed |
| 69 | + |
| 70 | +## Project Structure |
| 71 | + |
| 72 | +The project is structured with a clear separation between frontend and backend components, allowing for potential frontend reimplementation (e.g., with JavaFX) while maintaining the same backend structure. |
0 commit comments