Course:CPSC312-2023/Game-of-life

From UBC Wiki

Authors: Gloria, Steven, Amaan

What is the problem?

Conway's Game of Life is a 0 player cellular automaton game, where the evolution of the game is determined by the initial state. We will be implementing a version of the Game of Life in Prolog.

What is the something extra?

We've created a UI with animations, and default map selection, as well as implemented a variant of the game that uses multiple colours.

What did we learn from doing this?

As we developed our project, we gained more experience on how to use XPCE to build a GUI. As we worked with XPCE to try and create animations, we discovered that using sleep/1 in between loops to try and 'time' our animations led to choppy animations, since it halted the entire program's execution which was not our intended behaviour. We had to use XPCE's built-in timer function to remedy this.

Outside of XPCE, we gained more experience working with Prolog in general and gained some intuition on how logic programming differs from object-oriented programming. One key difference we noticed is that while in object-oriented languages, a global variable has to be explicitly defined prior to program execution, in Prolog a global variable can be emulated without having to explicitly define it via using assert and retract to dynamically add predicates to our view - a behaviour that we saw as advantageous.

When implementing our 'something extra', we also learnt some more about the Game of Life and the different types of variations (game modes) it can have.

Links to code etc.

https://github.students.cs.ubc.ca/glorixz/cs312prj2-game-of-life