Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I had a quick go at this with Racket: https://gist.github.com/twfarland/a9d8ce9eff22b39d3136

I'm not sure if I got the problem right, because it solves the hardest case almost instantly (2006 lions, 2055 wolves, 2017 goats -> 4023 lions), in 0.8s on my macbook air.

I used a general search algo that I've also used in the past for the missionaries and cannibals and snake cube puzzles.

It uses a set to store the past states seen, instead of deduping a list.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: