Omar-V2 / game-of-life

conway's game of life implemented in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Game of Life

This is a Golang implementation of conway's game of life

This is my first real Golang program, I chose conway's game of life as a method of learning/getting familar with golang.

The Ebiten game library, a simple 2D game library was used for the visualisation componenet of the project, somewhat similar to Pygame for those coming from a python background.

To me, the most beautiful thing about conway's game of life, is how global complex patterns can emerge from such simple local rules a phenomena often termed Emergence.

Usage

This program has two modes a standard mode and an interactive mode

Standard mode

The standard mode is the default and it can be run by executing the main.go file: In this mode, the first generation of cells are randomly created. A less densely populated board can be created by modifying the density via a command line flag (lower number is more dense, default value is 10).

go run src/main.go

one

go run src/main.go --density 25

one

Interactive mode

In the interactive mode, the user can draw the starting state of the cells using their mouse by left-clicking. Once the desired pattern of cells has been drawn a right-click will trigger the simulation. Pressing the middle-mouse-button will stop the currently running simulation, clear the board of all cells and return the user to a state where they can draw a fresh starting state.

go run src/main.go --interactive

one

About

conway's game of life implemented in Go.


Languages

Language:Go 100.0%