Agent that solves Sokoban puzzle.
Bot that was made to solve Sokoban puzzles on this website.
An example puzzlehere.
- sys
- numpy
- keyboard
- Image
- os
- Downloads the map canvas and changes it to B&W.
- Maps pixels to txt characters.
- Maps every k x k block tile to single character.
- Now BFS based algorithm can use this .txt map to find a way to solve the puzzle!
First you need to download the map.
You can use this script, (it's also included in project files get_canvas.js
).
I use https://tampermonkey.net/ to make it faster.
Type it in Web inspector console.
const result = document.querySelectorAll("canvas")
const dataUrl = result[0].toDataURL('image/png').replace("image/png", "image/octet-stream");
window.location.href = dataUrl;
After that you need to install all required libraries in Solve.py
Run sudo python Solve.py
to start the program.
Better blocks mapping, because now it works only when blocks are 64 x 64.
Another BFS based algorithm or A* running as parallel thread.
Maybe do all with only one script.