Hello,
I am currently trying to teach myself python. This isnt my first language,
as I used to be quite good at using java. But it seems to be a bit harder
for me to understand some stuff. Right now, in trying to teach myself the
language, I thought I would make a simple text based game, like Zork or
Adventure or whatever. Anyway, right now I am trying to create the map
generating function, and I am not exactly sure what to do.
Here is all of the code I have so far:
------------
class Map():
def __init__(self):
self.make_map()
def make_map():
#first create array to store data
map = [][]
for x in range(10):
for y in range(10):
map[x][y] = map_random()
def map_random():
#This would do something simple, such as deciding whether
#this is grass or gravel terrain and if there is an object
#nearby
-------------
I really like python, but the one thing I really hate is that most of the
tutorials treat it like interactive scripting instead of object oriented
development, which really confuses me. So basically right now I dont even
know what equivelent version of main() I would write. I also dont understand
how I could write an accessing method so that I could write Map(1,2), since
the only place that deals with arguments is the __init__ function I think,
and that doesnt seem to deal with arguments. Any help or links to sites
about python and OO stuff would really be appreciated.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor