back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md82
1 files changed, 61 insertions, 21 deletions
diff --git a/README.md b/README.md
index 1e87112..5033e57 100644
--- a/README.md
+++ b/README.md
@@ -1,35 +1,74 @@
-# Picture puzzle
+# Picture Puzzle
<img src="puzzle.png" />
-A desktop game similar to the standard widget in windows 7. The game is written
-in C++ (including C++17 standard). FLTK was used as a graphics library. This
-library is not as heavy as Qt, and allows to quickly create an application with
-graphical widgets.
+A desktop sliding puzzle game similar to the standard widget in Windows 7.
+Written in modern **C++17** with **FLTK** for the graphical interface, it
+provides a lightweight, cross-platform experience with fast compilation and
+responsive UI.
-The essence of the game should be clear: to collect the image in its original
-form, moving one puzzle per move.
+The goal is simple: rearrange the tiles to restore the original image, moving
+one piece at a time.
-The application has the following features:
+---
-- *upload your image in any format and resolution. The program itself will
- resize, cut into puzzles, create the appropriate directory and save them in
- it.*
+## Features
-- *showing the complete solution of the puzzle using the optimization algorithm
- A\*.*
+### Image Handling
+- Upload an image in **any format and resolution** — the program will:
+ - Resize it to fit the puzzle grid (`300x300`).
+ - Slice it into `3x3` tiles.
+ - Save tiles into a dedicated `resources/` subdirectory.
+- Uses **stb_image**, **stb_image_resize**, and **stb_image_write** for image
+loading, resizing, and saving.
-- *the game is distributed in a single executable file by embedding the original
- standard image (toucan image) in the executable file. The image data is stored
- in an array in an object file (resources.o)*
+### Built-in Embedded Image
+- **Both Linux and Windows builds include a fully embedded image** (Toucan) directly inside the executable.
+- The embedded image is stored in `resources.o` as a static **byte array**.
+- A C-language **image converter** tool is included, which:
+ - Takes a PNG image.
+ - Generates a `resources.cpp` file containing the image bytes.
+- This allows shipping the game as a **single executable** without requiring external image files.
+- The embedded Toucan image serves as the default puzzle; users can still load their own images.
-- *support for \*unix and Windows platforms*
+### Puzzle Gameplay
+- Standard 3×3 sliding puzzle with one empty tile.
+- Random shuffling with **solvability check** to ensure the puzzle can be
+completed.
+- Option to load:
+ - Built-in embedded image.
+ - External images from `resources/` folder or user upload.
+
+### Automatic Puzzle Solver
+- **A\*** search algorithm implementation.
+- Uses **Manhattan distance** as the heuristic (`g(n) + W(n)`).
+- Shows a **step-by-step animation** of the optimal solution.
+
+### Cross-Platform
+- Works on **Linux** and **Windows**.
+- On both platforms, distributed as a single executable with embedded resources.
+
+---
+
+## Technologies Used
+- **C++17 STL** — `std::unique_ptr`, `std::shared_ptr`, `priority_queue`,
+`unordered_set`, `filesystem`, `algorithm`.
+- **FLTK** — lightweight GUI library.
+- **stb_image** / **stb_image_resize** / **stb_image_write** — image processing.
+- **A\*** algorithm for optimal pathfinding.
+- Custom hashing and equality comparison for puzzle states.
+- **Custom C-based resource generator** for embedding binary image data into the executable.
+
+---
## Building
-For \*nix platform, you need to install FLTK library and then do the following:
+### Linux
-```
+Install FLTK development package:
+
+```bash
+sudo apt install fltk1.3-dev
git clone https://git.scratko.xyz/picture-puzzle
cd picture-puzzle
make
@@ -38,6 +77,7 @@ make
## For Windows platform
-The built executable file (under x86_64) is available at the link: <a
-href="https://scratko.xyz/games/puzzle.exe" target="_blank">Download Windows
+- Requires FLTK for Windows.
+- Prebuilt x86_64 executable available here:
+<a href="https://scratko.xyz/games/puzzle.exe" target="_blank">Download Windows
version</a>