tag:blogger.com,1999:blog-5743983044224833668.post1489310027490611329..comments2023-03-30T02:13:37.406-07:00Comments on Fatvat: The Game of Life in Clojure.Jeffhttp://www.blogger.com/profile/08195722595923882332noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5743983044224833668.post-392722267109321742009-01-05T11:17:00.000-08:002009-01-05T11:17:00.000-08:00Thanks Matt - that does sound like a better way of...Thanks Matt - that does sound like a better way of doing it. Zip is ugly because I have to rebuild the co-ordinate to value mapping each time and, as you suggest, it isn't going to work with sparse grids. I'll have a look at refactoring the map representation and see what difference it makes to the shape of the code!Jeffhttps://www.blogger.com/profile/08195722595923882332noreply@blogger.comtag:blogger.com,1999:blog-5743983044224833668.post-60596494837275455692009-01-05T10:47:00.000-08:002009-01-05T10:47:00.000-08:00While writing a little tile based platformer test ...While writing a little tile based platformer test game I came across similar issues with storing grid data and position. I ended up using a sorted map with the keys being vectors containing the coordinates and the values being whatever data you need so that [x y] => cell data. This made it easy to update a cell (well reduce the grid in my case) based on the values of its neighbours.<BR/><BR/>As it was sorted, I could still iterate through the cells as needed. Another advantage for this approach for me was that it works out well for sparse data grids.<BR/><BR/>Not sure if this is much of an improvement for your purposes, but it at least is another option.Matt Clarkhttps://www.blogger.com/profile/00978997406139166492noreply@blogger.com