[Haskell-cafe] Game of life in haskell.

Lyndon Maydwell maydwell at gmail.com
Tue Feb 2 10:57:52 EST 2010


I chose the array mainly for the fast lookup time compared to lists,
are you suggesting something like creating a "Map (X,Y) Health"? I'm
not currently updating any structures, rather creating the successor
from scratch. I can see how the map may work very well for the sparse
nature of non-early life games now that I think of it.

On Tue, Feb 2, 2010 at 11:48 PM, Serguey Zefirov <sergueyz at gmail.com> wrote:
> 2010/2/2 Lyndon Maydwell <maydwell at gmail.com>:
>> Hi Cafe.
>>
>> I've made a basic game of life implementation with Haskell and OpenGL:
>> https://github.com/sordina/Life/
>>
>> I'm intending to improve the performance, and add more advanced
>> features, but I thought I'd get some feedback first. Can anyone see a
>> way to make this code more idiomatic, or any optimizations I might
>> have missed?
>
> Arrays are not fully "idiomatic" for Haskell as they are hard to
> update functionally.
>
> Also, their use incurs quadratic update cost for simple scene with two
> gliders that fly in different directions.
>
> So I advice you to use Data.Map.Map and Data.Set.Set data structures.
>
> How? It's an easy question. ;)
>


More information about the Haskell-Cafe mailing list