Course:CPSC312-2017-Game-of-life

From UBC Wiki

Title

Authors: Alexander Lim, Felix Tso, Marcus Wong

What is the problem?

For this project, we wish to use Haskell to simulate Conway’s Game of Life. The Game of Life consists of a m x m grid where each cell can either be populated or unpopulated. The cells can change state with each ‘tick’ of the program by adhering to 4 rules: Any live cell with fewer than two live neighbours dies Any live cell with two or three live neighbours lives on Any live cell with more than three live neighbours dies Any dead cell with exactly three live neighbours becomes a live cell The first generation is created by applying the above rules simultaneously to every cell in the seed, birth and deaths happen simultaneously.

The Game of Life is turing complete, meaning that it has the same computational power as a universal turing machine, so it is theoretically as powerful as any computer with unlimited memory and no time constraints.

What is the something extra?

We will implement a UI for our program so that we can represent the populated or unpopulated with colored in cells instead of just showing the generated array of pairs. In addition, we will allow users to input their own initial state of the program as well as number of generations they want to see.

What did we learn from doing this?

We learned that Haskell is very good for solving problems that are recursive or grid oriented. We were able to implement Conway's game of life very concisely and clearly. Overall, functional programming is very suitable for implementing Conway's game of life because functional programming paradigms such as map, filter, list comprehensions allowed us to easily express the logic required in Conway's game of life. Some challenges we faced included displaying the state of the game in a user friendly format and figuring out how to design the data structures necessary for the game.

Project here