[Tutor] Python information

shey crompton shey@argonaut.com
Fri, 2 Aug 2002 09:31:03 +0100


Hi Rob et al,
A python Robocode game sounds like a great idea for a newbie like me. I wish
I had the knowhow to write a game like that as it would probably be quite
beneficial to complete newbies, and programmers checking out Python.
One initial idea would be to have a tutorial that takes you through each
part of the robot code. For example, changing the hit points on the enemies
(newbie), adding a bigger weapon with graphics etc to your own robot
(intermediate), and rewriting the AI for the enemies (expert). 
I am currently going through Alan Gauld's book and How to Think Like a
Computer Scientist. I am setting myself little goals and trying to find out
how to achieve them with the knowledge I have. I feel having a game to
adjust the attributes in the code would help all round to show off Python's
versatility, while helping people to learn how to program. 
I am interested to hear what people on this list feel about my idea. As I
said, I don't have the knowledge (Yet!) to make the game, but I would like
to give it a go one day, or help someone with the design, and/or testing of
such a program. 

I think I'll stop now. :-)

Shey

 -----Original Message-----
From: 	Rob [mailto:rob@uselesspython.com] 
Sent:	02 August 2002 04:23
To:	'Tutor@Python. Org'
Subject:	RE: [Tutor] Python information

OOP does seem to be an interesting situation. We think in objects all day
long, and yet when it comes time to program along the same lines, struggle
seems common.

Perhaps we should put our collective heads together and create a Python
equivalent to Robocode, which is designed to teach OOP in Java by having you
program battling robot tanks.

Let's say you want to write a "Dungeons & Dragons"-type game. You know
you'll need it to have certain things (objects). You make a list of some of
them:

-monsters
-dungeons
-non-player characters
-player characters
-weapons
-treasure
-equipment
-etc.

Some of these can be lumped into more general categories. For instance,
non-player characters and player characters can both fall under the category
(class), which can just be called "character". All characters can possess
certain characteristics in common, such as:

-amount of damage that may be survived
-height
-weight
-name
-species
-vocation
-inventory
-etc.

The process goes on and on, really. The idea is to think of what kind of
objects you will want/need in your program, create classes for these
objects, and then create instances of these classes. A class instance can be
"Banglor the Elf", a specific instance of class character.

Objects have two general things the programmer needs to fuss over:
attributes and behavior. Attributes can be the character's name, hair color,
fondness for dirty poetry, etc. and behaviors can be throwing spears,
running, singing, sleeping, and stopping going forward when bumping into
walls.

Does any of this sort of discussion help at all?

Rob (who should really be studying for tomorrow's C++ final ;-)
http://uselesspython.com