![]() |
(Conway's Game of Life)
Can someone please show me the python code for (Conway's) Game of Life so I can use it as a template to create a similar game.
|
I wrote an implementation of the Game of Life for a college assignment back in 2000... but it is in C++. I'll post it if you are interested.
|
You can find an excellent simulator here. It includes downloadable source code in Java.
|
This is just what I knocked up in a text editor, so I haven't tested or run it yet, but it seems like it would work. I'll test it when I get home.
:
class Grid: |
I never understood that game
How are you supposed to play the game of life huh? I tried it many times but I just get pixels moving around my screen and killing each other or something, could somebody explain me how it works? Cause I don't get it! lol
-:A:l:e:- |
It's not a "game" per se. It's a set of simple rules designed to result in more complex behaviour, much as the rules governing organisms in life result in larger biodiversity.
The game takes place on a two dimensional board. Each square on the board can either be empty, or contain a "cell". Each square (X) on the board has eight neighbours bordering it, both adjacently and diagonally: :
1 2 31. If an empty square has three neighbouring cells, a new cell is created in that square 2. If a cell has less than two neighbouring cells, it dies of loneliness 3. If a cell has more than three neighbouring cells, it dies from overcrowding |
Here's my version, heavily commented and elaborated because I don't know how experienced in Python you are to understand it.
:
from os import system # for clear screen function |
| All times are GMT -5. The time now is 11:13 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC