Skip to main content
20 votes
Accepted

Coded the Game of Life

You are not assigning default values to the fields and you are splitting game logic and UI. That's a good start. public Game(int i, int j) { In a public function ...
Maarten Bodewes's user avatar
17 votes
Accepted

Conway's Game of Life Object oriented implementation in Java

It's hard to judge a design when there is no information about what you want from it. If you wanted classes and methods, well you succeeded, but that's about it. But if you, for example, wanted ...
TorbenPutkonen's user avatar
16 votes
Accepted

Conway's Game of Life Terminal Visualization in C

I'm impressed that this is your first project in C -- it's good! What follows are some comments on what's good that you should continue to do and then some suggestions for improvements. What's good? ...
Edward's user avatar
  • 66.6k
14 votes

Conway's Game of Life Object oriented implementation in Java

Thanks for sharing your code! OOP doesn't mean to "split up" code into random classes. The ultimate goal of this is to reduce code duplication, improve readability and support reuse as well ...
Timothy Truckle's user avatar
12 votes
Accepted

A Pythonic implementation of Conway's Game of Life

Your code is pretty good, and there's not much I'd change. However I would change it in the following ways: It's standard to use UPPER_SNAKE_CASE for Enum values. ...
Peilonrayz's user avatar
  • 43.5k
11 votes

Coded the Game of Life

I made some modifications to your View class and created this GUI. I couldn't get the Game class to cycle through generations. ...
Gilbert Le Blanc's user avatar
10 votes
Accepted

Game of Life with NumPy

That next_state function creates two brand new numpy array. Creating numpy array is slow. Should just update an existing numpy array. Can divide the code into two ...
hamster on wheels's user avatar
10 votes

Conway's Game of Life Object oriented implementation in Java

As TorbenPutkonen notes, it's hard to judge your design without knowing what your goals are. That said, in a practical GoL implementation (aiming at reasonable memory and CPU efficiency) your outward-...
Ilmari Karonen's user avatar
10 votes

Conway's Game of Life Terminal Visualization in C

I can't (yet?) comment on the (excellent) first answer, or I would. But I have a few comments to add to what has already been said: In Unix you don't need to check the result of malloc, if having the ...
jimc's user avatar
  • 101
9 votes

Game of life(random generation)

Using attributes Why is iteration passed into the LifeGame.print function? This makes more sense to me as an attribute on ...
DeathIncarnate's user avatar
8 votes
Accepted

SDL2.0 Conway's Game Of Life

Turn your warnings on! I would always compile with -Wall -Wextra -pedantic -pedantic-errors :) Let's go through them: ...
Rakete1111's user avatar
  • 2,572
8 votes

A Haskell implementation of Conway's Game of Life, viewable on the console, no external libs

Since you haven't specified any focus points, I'll focus on readability. To speed things up, you may want a Matrix or Vector to ...
sshine's user avatar
  • 741
8 votes

Coded the Game of Life

I would recommend changing how your grid is represented in memory. Imagine you have a 10000x10000 grid and just 1 cell at coordinates (5,5) that's alive. If you use an array to store that information,...
Graprar's user avatar
  • 81
8 votes
Accepted

Learning C: Conway's Game of Life

Here are some things that may help you improve your code. Fix the bug The code currently includes this line in initialPosition: ...
Edward's user avatar
  • 66.6k
8 votes
Accepted

Conway's Game of Life in C

General Observations Initially I was very impressed because the file started with the declaration of 2 enums. All of the functions seem to follow the single responsibility principle and that is great! ...
pacmaninbw's user avatar
  • 24.8k
8 votes

Conway's Game of Life in C

Reduce number of tests. An if in the tight loop is a performance killer. Since you test for cells[x][y].alive in ...
vnp's user avatar
  • 57.3k
7 votes
Accepted

Game of Life, a shorter story

The hard coded configurations look extremely painful. A good technique in this kind of situations is to come up with a convenient way to write the configuration by humans, and some helper functions to ...
janos's user avatar
  • 112k
7 votes

Python Conway's Game of life

Quite nicely structured. some remarks main() - while you have the guard and also an extra printing function there is a little mess in ...
stefan's user avatar
  • 2,980
7 votes

Python Conway's Game of life

There is one bug: table = update_table(table, height, width) in the “main loop” should be ...
Martin R's user avatar
  • 23.5k
7 votes

Game of life GUI simulation using java.swing

The first thing that I notice when looking at the code is something that directly stings in my eyes: Formatting. The code is is not formatted according to the SUN or Google Code Conventions (which are ...
Christian Hujer's user avatar
7 votes
Accepted

Reverse Game of Life

Reduce the search space For each cell, it looks like the code always considers all 512 possible 9x9 configurations for the previous generation. However, if the cell is currently alive, you know that ...
RootTwo's user avatar
  • 10.2k
6 votes

Game of Life (Java)

Unicode - nice I see you directly use Unicode. I like that. Incorrect solution Your program is actually NOT an implementation of Game of Life, because your universe is finite. The universe size is ...
Christian Hujer's user avatar
6 votes
Accepted

Game of Life improvement

I'm unsure what you mean by saying "improve the user interface". AFAIK Game of life doesn't have much of a user interface as it's a simulation that only displays the grid and whatever happens on it. ...
yuri's user avatar
  • 4,458
6 votes
Accepted

Game of life in Go

I really liked the way you used Termbox; you should try Tcell as well for fun. Review The function ...
STEEL's user avatar
  • 228
6 votes
Accepted

LIFE in Python 3

I think your get_neighbor function can be cleaned up using min and max, and by making use of ...
Carcigenicate's user avatar
6 votes
Accepted

John Conway's Game of Life in C++

General Observations Not too bad if this is your very first C++ program. You need to become aware of the Standard Template Library which provides data structures such as std::array and std::vector. ...
pacmaninbw's user avatar
  • 24.8k
6 votes

Game of life(random generation)

You explain that you wish to improve CPU consumption but you don't know where to begin. Always start optimizing by asking "where did the cycles go?" Run the profiler: ...
J_H's user avatar
  • 35k
5 votes

Parse Run Length Encoded file for cellular automaton data

Apart from @Graipher's great answer (my answer is based on his), I'd use the following when it comes to multi-line styling: ...
Grajdeanu Alex's user avatar
5 votes
Accepted

Java Game Of Life

...
Pimgd's user avatar
  • 22.3k
5 votes
Accepted

Conway's Game of Life in Win32/GDI

Regarding 1.: Sure, you can just add a border to your field. That's trading space for code-simplicity, which is distinct from efficiency. Regarding 2.: Sure, there's no reason why you cannot just ...
Deduplicator's user avatar
  • 19.3k

Only top scored, non community-wiki answers of a minimum length are eligible