Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Conway's Game of Life in Scala ( and Clojure ) (jasq.org)
4 points by dxbydt on Aug 30, 2012 | hide | past | favorite | 2 comments


Great transliteration of the clojure code. We should try to scale it up and see what the speed differences are.


Did some profiling with gliders using Conway's rules.

To compute the next generation of 100 gliders takes 480 ms To compute the next generation of 1000 gliders takes 5 s. So, scales linearly.

    stepper( nbrs  _, List(3).contains _, List(2,3).contains _)( (1 to 1000).toList.map( x=> List((x-1,x),(x,x),(x+1,x))).flatten)
I guess if you replace the default collection ( List of Lists ) with a powerful sparse double matrix ( http://acs.lbl.gov/software/colt/api/cern/colt/matrix/impl/S... ), you could eke out some gains...if you rewrote map and intersect and filter and flatten and contains and...ahhh that's just too much work :)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: