4 ms·
Conway's Game Of Life in Clojure
- naeg 14y agoActual author of the article here. Was really excited to see my own blog post on Hacker News, because I didn't even submit it here. I appreciate any kind of feedback, not only for the code or the explanations but also for my blog in general, style, etc. I'm rather new to blogging. Also, feel free to ask me anything.
- misnome 14y agoI have to say thanks for writing this; I am starting to try and pick up Clojure at the moment, and it's always nice to see lots of different and interesting examples (see: recent 'Caves of Clojure' series that was on here)
- austinlyons 14y agoI second this. I'm on a Clojure kick right now and am enjoying finding useful examples on HN.
- samrat 14y agoI found your post on Twitter and found it pretty useful, mostly because I'm reading the same book as you are(Clojure Programming) and was having some difficulty groking this program. Your post really helped. There is a typo in line 8, I think it should have been (range h).
- mrspeaker 14y agoDo you think this style would extend nicely to a larger 2d game? I've been trying to think more functionally when making games, but it seems like games are really just one great big ball of state. I've seen a bunch of examples of cellular automata and, for some reason, Asteroids - but nothing "bigger". Does anyone know any nicely-written larger projects (I'd love to see a platform game) around?
- samrat 14y agoSteve Losh is doing a series about making a roguelike in clojure actually- http://stevelosh.com/blog/2012/07/caves-of-clojure-01/ http://stevelosh.com/blog/2012/07/caves-of-clojure-01/ You might find those useful.
- naeg 14y agoI'm not experienced in game developing nor am I in functional programming, but there seem to be a few things out there. What samrat said and this one (in Haskell): http://joyridelabs.de/ http://joyridelabs.de/ They are also blogging about their development.
- drbawb 14y agoNice; just wrote a [fairly naive] implementation in Go myself. It works but it's not very fast. For a 36x36 grid; I can do ~5,000 iterations in < 30 seconds or so. I'm sure a large part of the bottleneck is the fact that my "viewer" is just STDOUT redirected to a file; I want to implement some buffered I/O and then try my hand at writing HashLife. I have to admit: I didn't think the game of life would be much of a game; but it's fairly fun to mess around with!
- naeg 14y agoWould you share your Go implemenation with us? Curious about Go, too.