[Tutor] samples

Andrei project5 at redrival.net
Thu Jun 23 13:25:12 CEST 2005


D. Hartley <denise.hartley <at> gmail.com> writes:

> code, but it's made up of 46 different .py files, none of which seem
> to be the "main" game (lots of little modules, like an input box, a
> high score list, etc).  It's a lot harder for someone new to
> programming to read. 

Identify the main file (the one that you launch) and go from there. A search for
'main' might turn up something. Having all code in one big file makes it more
difficult to read for advanced users, but also for beginners. Make sure you use
a good editor with code outline support (outline of classes/methods), it makes
it easier to explore the code.

> Also, the reason that I would like to see several examples is that I
> would like to see how different people approach things like keeping
> track of the columns' being filled or not, how they approach timing
> questions, whether or not they give hints, that kind of thing.  I did
> game.  I have donwloaded tetris clones as well, and have made one
> myself (getting toward the falling objects idea, anyway), but they
> havent been on a static board which is filled at all times with
> objects. Nor have I ever, actually, done anything with mouse clicks
> (!!).

Except for tetris, you could also look at othello/reversi, five in a row,
checkers and chess. They deal with sequences of pieces, clicking on pieces to
move them and (depending on the implementation and target audience) hints. It
might be even more instructive to look at differences between the games than to
look at differences within a game.

> at my disposal, and what's more, I want to figure it out on my own.

I'd say you shouldn't be shy about borrowing ideas (and even code, if the
licence allows it) from other people. Usually the best way to learn is not by
starting with the development of the wheel.

> Does anyone have any little "gamelets" like these, or know of

I remember not too long ago there was a discussion on the pygame list about
developing a partygame-like system, with a framework capable of loading all
kinds of simple minigames. I don't know how far it is by now, but if you look in
the pygame mailing list archives you should be able to find it.

Yours,

Andrei




More information about the Tutor mailing list