# [Tutor] matrixes

Tue Apr 27 20:22:29 EDT 2004

```Hello,

I have to recreate a text-based game 'visually' for school and I was
hoping you could help me with things I've run into.

One of the first things I've run into is how to deal with matrixes in
python. If I have the following matrix with 'glade' being location
(0,0):

forest	river	desert

woods	creak	dunes

I was thinking of representing like this:

matrix = (('glade', 'stream', 'mountains'),('woods', 'creak', 'dunes'),
('forest', 'river', 'desert'))

Is this the correct way and 'pythonic' way of doing it, or am I missing
a module or something.

The starting location would be glade, and I would represent that in the
location variable:

location = [0, 0]

and then north would be:

north = [0, 1]

and then if the input would be north. I would do something like this:

location =  [location[0] + north[0], location[1] + location[1]]

The problem is if you went south for your first 'move' how would i make
it wrap and end up at forest?

This seems like a real roundabout way of doing things, is there a
better/faster way of doing this?

As for my visual part, I was thinking of having a command line prompt to
take input and a seperate window which shows a picture depending on
which place you would be. This picture would have to dynamically change
and pretty rapidly. I'll do a little research before asking about it.

Thanks a lot!!

P.S. The teachers want me to make this in Flash or html, or any tools
found in our computer labs. But I think python would be appropriate for
the job. *grin* I'm not sure I could use pygame because im either going
to have to boot knoppix to demonstrate the game or find a small python
distrobution that can go on the labs, without adminstrative priveleges
since they only use windows. I relize this is homework but I do not
think the questions detract from the assignment.

```