Skip to content

ferealqq/15GoFast

Repository files navigation

15GoFast 💫

About

15 puzzle solver implementation with golang.

Generally the algorithmic implementation of the application focuses on the fastest possible solve time. In hindsight the implementation could be even faster, but generally the algorithm implementation achieves very fast sovle times when taking into accord that this implementation does not contain a pattern databases (walking distance table isn't a pattern database imo). Best possible solve time can be only achieved with pattern database.


Stack

Dependencies

Reports

week 1 week 2 week 3 week 4 week 5 week 6

Usage

Executable applications can be found in the releases page

Start:

# linux 
wget https://github.com/ferealqq/15GoFast/releases/download/v0.0.1/15GoFast-linux-amd
chmod +x 15GoFast-linux-amd
./15GoFast-linux-amd
# macos  
wget https://github.com/ferealqq/15GoFast/releases/download/v0.0.1/15GoFast-darwin
chmod +x 15GoFast-darwin
./15GoFast-darwin
# windows  
echo "Don't know, not sure, don't want to find out"

Installation

  • Install node: here
  • Install golang: here
  • Install wails: guide
    • If you are familiar with go you can install wails with command: go install github.com/wailsapp/wails/v2/cmd/wails@latest

Run:

wails dev

Live Development

To run in live development mode, run wails dev in the project directory. This will run a Vite development server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect to this in your browser, and you can call your Go code from devtools.

Building

To build a redistributable, production mode package, use wails build.

Testing

To test the core logic of the application run:

# takes 1s to 8s depending on how hard the random generated puzzles are.
go test . 

Some times the tests may exceed the time limit of solving the puzzle board. But exceeding the time limit should be very rare.

Profiling

Profiling is done with pprof. Usage:

go tool pprof "profile_file" 

To generate profile's use the following guide.

Generate IDAStar's cpu profile run

go clean --cache ; go clean -testcache ; go test -run "TestPerformance" -cpuprofile cpu.prof
go tool pprof search.prof
(pprof) web