Questions tagged [conways-game-of-life]

The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. The "game" takes place on a 2D grid made up of cells that may either be "alive" or "dead". At each iteration, the state of each cell is computed based on the states of the cell and its 8 neighbors at the previous iteration.

From Wikipedia:

The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.

The "game" is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves.

594 questions
5
votes
2 answers

Conway's Game of Life with Python

I took a liking to Conway's Game of Life and began to try and write it in python. At this moment I have yet to write any code for the borders of the program so I am just asking for help with what I have right now. I seem to have trouble when…
Gubsz
  • 59
  • 1
  • 1
  • 4
5
votes
3 answers

Conway's Life | Powershell

I have been working on creating a basic Conway's Game of Life simulator in Powershell to get more familiar with the language. But my current code is incorrectly counting # of neighboring cells, so the game is not working. I believe my wrapping is…
Christopher
  • 790
  • 12
  • 30
4
votes
1 answer

Issue with Game of Life

I'm working on a Java implementation of Conway's game of life as a personal project for myself. So far it works but the rules are coming out wrong. The expected patterns aren't showing up as well as it should. Is there something wrong with my…
bringel
  • 482
  • 5
  • 17
4
votes
1 answer

Why is my haskell program so slow? Programming in Haskell, game of life

I'm going through the "Programming in Haskell" book (second edition) and noticed that the "game of life" example is getting extremely slow after some iterations (it looks like it's getting exponentially slower with every iteration). I profiled it,…
Piotr Justyna
  • 4,888
  • 3
  • 25
  • 40
4
votes
3 answers

How can I conveniently convert a 2-dimensional array into a 2-dimensional vector?

I'm following the Rust-wasm tutorial and I want to be able to easily add a ship (a shape really) to the Universe in the game of life. As a first step, I'd like to convert a 2-dimensional array of 0 or 1 representing a shape into a vector of indices…
DjebbZ
  • 1,594
  • 1
  • 18
  • 34
4
votes
0 answers

How to change focus of a Haskell Store Comonad on a 2D list

I am strugling with the following problem. I am trying to make Game of Life using store comonads in Haskell. I have the following relevant code: type Cel = ((Float, Float), Bool) type Field2D = [[Cel]] I have then created an initial…
Thobro
  • 41
  • 2
4
votes
1 answer

Detecting repetitions in Conway's game of life

This is a bit of a theoretical question. In a programming assignment, we have been told to implement the Game of Life by John Conway. As an additional task, we've been asked to modify the program so that it can detect repetitions of patterns for…
Sahand
  • 7,980
  • 23
  • 69
  • 137
4
votes
3 answers

Non-iterative algorithm for 1D game of life

Consider a Boolean array a[n], where each element is a cell. A cell becomes alive (set to true) in the next generation if one and only one adjacent cell is alive, otherwise it becomes dead (set to false). The first and last cell are considered…
Henricus V.
  • 898
  • 1
  • 8
  • 29
4
votes
3 answers

C++: Can a class has an object of it's own type?

I am trying to solve the Conway's game of life in c++. So according to my design, I have a cell class which contains a list of 8 neighbours, which itself is an object of type cell. Is it ok to do that. The code looks like this class Cell { private: …
divine-code
  • 107
  • 2
  • 6
4
votes
2 answers

Game of life in F# with accelerator

I'm trying to write life in F# using accelerator v2, but for some odd reason my output isn't square despite all my arrays being square - It appears that everything but a rectangular area in the top left of the matrix is being set to false. I've got…
John Palmer
  • 25,356
  • 3
  • 48
  • 67
4
votes
3 answers

Best solutions for designing two dimensional world - Game of life

I need to create application which would simulate predator-prey relationship. I can use some framework( ex. repast), but I am wondering about writing application from scratch. The biggest problem for me is way of representing map with food sources,…
nervosol
  • 1,295
  • 3
  • 24
  • 46
4
votes
2 answers

Conway's Game of Life logic error

I'm taking a class that uses C# and our first assignment is to implement Conway's game of Life. We must do this by reading in a text file formatted something like this: * * *** *** We then have to display the next 10 generations on…
user2773218
  • 87
  • 1
  • 6
4
votes
2 answers

Golly game of life in a gif

I have a talk in a few days. I have to make a reference to the cellular atomata. I would like to show a little gif in the slideshow where the evolution of cellular automata is shown, so my question is:How can I convert a pattern and the evolution…
emanuele
  • 2,519
  • 8
  • 38
  • 56
4
votes
1 answer

Conway's Game of Life GUI

I have been working on a copy of Conway's GOL for class and I'm having an issue when the GUI renders. Quick rundown: GUI Creates a Frame and a mainPanel, set to BorderLayout. Once I instantiate the Grid itself and assign it to the mainPanel, it…
hedrick
  • 211
  • 4
  • 13
3
votes
3 answers

Game of Life(PHP)- not understanding my output

So, basically, I've been writing this Game of Life PHP script. My output is wack and I can't figure it out! The whole scheme consists of a 2-dimensional array called $world in which each value corresponds to a 2-state cell that can be 1 or 0(alive…
rocketas
  • 1,679
  • 3
  • 18
  • 30
1
2
3
39 40