cubing / cubing.js

🛠 A library for displaying and working with twisty puzzles. Also currently home to the code for Twizzle.
https://js.cubing.net/cubing/
GNU General Public License v3.0
232 stars 42 forks source link

Export a generator API for `twsearch` #288

Open lgarron opened 10 months ago

lgarron commented 10 months ago

Right now, experimentalSolveTwsearch(…) outputs up to one solution. It is possible to get multiple solutions by specifying a min depth, which will randomize the search each time: https://github.com/cubing/cubing.js/blob/39925529e4beee9211b656fd2fa85e22b1242061/src/cubing/search/inside/solve/twsearch.ts#L66

However, it would be much better to implement a generator API that pulls solutions from C++ → Rust → WASM → JS. It's okay for there to be a bit of extra/redundant work as long as the API is simple to use.