[Tutor] Help Designing a simple Program called Life

Alan Gauld alan.gauld at btinternet.com
Thu Feb 23 01:25:51 CET 2012


On 22/02/12 18:50, leo degon wrote:
> Hello All,
>              My name is Leo. I'm just beginning to learn python. I am
> learning on my own and have no previous programming experience. I
> decided to create a version of john conway's game of life as a personal
> project.

OK, Thats quite a good project for a beginner because it will require ac 
number of differentb concepts.

> I've been wondering what GUI to use.

Personally I'd say don't. at least not for a start. Get the game working 
on the console first then transfer it to the GUI later.
One of the fundamental paradigms for GUI program is the Model-View
paradigm where you have separate code to represent the logic of the 
program - the model - from that which displays the UI - The view.
You can have different views of the same model. eg. a text view
and a graphical view. You can even have both open at the same time!

In your case start with a very simple text view using print
statements.

> My idea is when the program initializes to have a root menu with a
> series of options.

In GUI progrqamming beginners often start by thinking about the GUI 
layout and controls. Thats usually the wrong place to start.
Start with the model.

In your case that's a grid or matrix with some cells filled in. You need 
to cyclically recalculate the status of each cell based on the status of 
the cells around it. (Hint: it may be easier to create a grid thats 1 
cell bigger in every direction than your display...)

> in-game options. I would like to be able to pause the game, run it at
> different speeds, and add new live cells to the board.  I would like to
> have multiple boards able to run at once, and I would like the option to
> save a board and its rules to load at a later time.

All good ideas but get the most basic one working first a hard coded 
starting point that morphs into the second generation. Once that works 
get the cycles running until you hit a key to stop. At that stage we 
might think about introducing a GUI... But thats probably quie a long 
way off just yet.

> I'd like any ideas on how to approach this project in general and specific.

Build a little, test a lot.

Think about how you will test it before you build it (this is known as 
test driven development - TDD - in software engineering circles. But 
it's good for amateurs too!)


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list