Entries Tagged ‘life’:

Haskell Life With Repa Part 2: Parsing Framework

Conway's Life - Gunstar

Life Pattern - Gunstar

In the last post, we built a simulator for Conway’s Life in Haskell using repa and OpenGL. The initial life pattern in that implementation was hard coded. In this post, I’ll build a framework for parsing patterns from files.

Read the rest…

Tags: , ,

Comments (1)


Conway’s Life in Haskell with Repa and OpenGL

Conway's Life in Haskell

The final state after starting with the acorn pattern

Repa is a new library in Haskell for handling arrays. It has flexible indexing like the old array library, but supports parallel computation, stream fusion, and has a rich API like the vector library.

To learn how to use repa, I implemented Conway’s Life using repa for the simulation and OpenGL for the display. The complete code is available on BitBucket and builds on my GLFW-b boilterplate, so I’ll only discuss the interesting parts here. Don Stewart wrote a good introductory tutorial to repa that will fill in any gaps I leave in this post.

Read the rest…

Tags: , , , ,

Comments (1)


Haskell Life

I’m starting to pick up Haskell again, and this time it’s finally clicking for me. Believe it or not, Learn You A Haskell explains monads in a way that actually makes sense! While I’m learning Haskell, I’m going to be making some dumb little projects. What better way to make sure I understand how they work than by explaining them on here? And who knows, maybe you’ll catch the Haskell bug, too.

The first project is a simple implementation of Conway’s game of life. The full source is at GitHub. There isn’t much to life, really. All we have to do is read or generate a starting grid, apply the rules to make grid N+1 from grid N, then draw a grid on the screen.

Read the rest…

Tags: , ,

Comments (1)