sliding-puzzle
sliding-puzzle copied to clipboard
Sliding puzzle game implemented in Scala / Scala.js / JavaFX
Sliding Puzzle
Sliding Puzzle implemented in Scala.
See the online demo here: http://www.sebnozzi.com/demos/sliding-puzzle/
Multi-platform
Thanks to Scala.js, it compiles both to:
- Desktop JVM application
- Browser JavaScript single-page application
As much as possible, I've tried to have UI and platform-agnostic code. This lead to a better design which made the different implementations not only possible but straightforward.
Desktop Version
The native JVM version uses JavaFX for its UI, and can be seen here:
Browser Version
Here's a screenshot of the Scala.js based version, running on the browser:
Building
JDK
Tested on JDK version 11 and 14.
Running
Run using SBT with:
sbt javafx/run
Scala.js Version
Unoptimized / Development
Development, or "fast-optimized", mode compiles code very quick. The generated file is still small enough (600 Kb)to load quickly in the browser (while developing), but not as small as in the "full-optimized" mode (131 Kb).
Package "fast-optimized" code with SBT with:
sbt scalajs/fastOptJS
This will generate "fast-optimized" JavaScript files.
To load this "development" version of the puzzle, open this file in your browser:
scalajs/index-dev.html
Full-Optimized / Production
Optimized code takes longer to compile / optimize, but the generated code is much smaller (around 130 Kb) and loads very quickly in the browser.
Generate fully-optimized code with SBT with:
sbt scalajs/fullOptJS
This will generate one optimized JavaScript file using Google's closure compiler.
To load the optimized version of the puzzle, open this file in your browser:
scalajs/index.html
Credits
Scala.js
Scala.js-related acknowledgements:
- Thanks to Sébastien Doeraene and the EPFL for Scala.js!
- Thanks to all Scala.js contributors
- Thanks to all maintainers of the Scala.js jQuery wrappers
- The multi-platform SBT setup is "inspired" by this project, also by Sébastien Doeraene
About the picture
The musicians you see on the picture are part of a Jazz "Big Band".
Tini Thomsen and Matthias Konrad with the Thomsen Group @ Birdland, Hamburg
I wanted to use this picture for this puzzle because it portraits two of my favourite jazz-instruments:
- baritone sax (left)
- trombone (right)
Original picture taken by Marc Wellekötter