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 ...
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 ...
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?
...
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 ...
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.
...
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. ...
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 ...
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-...
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 ...
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 ...
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:
...
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 ...
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,...
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:
...
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! ...
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 ...
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 ...
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 ...
7
votes
Python Conway's Game of life
There is one bug:
table = update_table(table, height, width)
in the “main loop” should be
...
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 ...
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 ...
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 ...
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.
...
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 ...
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 ...
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. ...
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:
...
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:
...
5
votes
Accepted
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
game-of-life × 225python × 55
java × 51
beginner × 38
c++ × 34
performance × 28
javascript × 19
python-3.x × 18
c × 12
object-oriented × 10
haskell × 10
cellular-automata × 9
c# × 8
swing × 8
pygame × 8
game × 7
ruby × 6
rust × 6
simulation × 6
sfml × 6
html × 5
multithreading × 5
functional-programming × 5
clojure × 5
console × 4