

Speeding up JavaScript Goats, Wolves and Lions by 18,800 times - curveship
https://gist.github.com/curveship/f1f7155ef5243af18bc2

======
curveship
This is inspired by last night's post to HN of the Goats, Wolves and Lions
problem:
[https://news.ycombinator.com/item?id=7855455](https://news.ycombinator.com/item?id=7855455)
.

I and others noticed that the javascript solution posted was far from optimal.
So for fun, I tried optimizing both it and the algorithm used. The end result
runs almost 20,000 times faster and handily beats all implementations in the
original post, including the carefully optimized C++11 one by almost 1000x.

As I say in the gist: it's still about the algorithm, not the language.

