7 ms·
The code is very inefficient to say the least. I made some modifications (diverging further from the "functional" nature, if you could call it that) and as you
by chapel 12y ago
The code is very inefficient to say the least.
I made some modifications (diverging further from the "functional" nature, if you could call it that) and as you can see it is much faster[0].
Output:
$ node new-magicForest.js 2017 2055 2006
total forests: 6128
{ goats: 0, wolves: 0, lions: 4023 }
total time: 20ms
[0] https://gist.github.com/chapel/1c038b2bf64b3037aaea https://gist.github.com/chapel/1c038b2bf64b3037aaea
- skratky 12y agoYour code contains a bug in the function getForestKey. See gist.