Skip to content

Nzen/Another_Klotski

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Klotski via js canvas

klotski stages (img via flickr)

Solve the klotski (sliding block) puzzle by moving the red block to the marked area.

Released under MIT license. You know, because I didn't invent klotski.

Status : /web/client_server - inactive (80%) /web/standalone_js - complete

Run

standalone_js: open /web/standalone_js/klotski.html , play.

client_server: Compile and run jar from /src (server runs the game), open /web/client_server/drawKlot.html (client presents the game) , play. build.gradle included for your convenience.

Dependencies - TooTallNate websockets 1.3 and Gson 2.8

Play

W A S D or arrow keys to move the cursor. Hold down shift to move the shape beneath it, when the way is clear.

Future directions

Tests
Virtually nothing tests itself or is tested. Partly this stems from a non-functional orientation. Nevertheless, Board - serialize, deserialize, in_goal_area, swap_block, try_cursor, try_block, and all the internal functions still need confirming tests. Screen, mercifully, seems testable by eye.

Invalid move
It could be cool to show when the cursor is trying to move in a direction it can't. I considered drawing a red bar that fades with a timer. But then I'd have to figure out the edge of the shape it's under in that direction.

Wiki
I like the idea of literate programming. But, it is only appropriate after the program is done. I could enliterate this, but would probably refactor it again before I did.

Hint system
I think there's one way of solving the puzzle, with symmetric variations. So, it is possible to have a solver calculate the moves (pdf) via a depth-first search. Then it could make a suggestion for the next move or something. What would be really fancy is a segmented arrow showing a four move path or something. Both sound like a lot of work.

About

Block puzzle via html5 canvas

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published