Computer Science question (python list is slow with my cruddy algorithm )

Bengt Richter bokr at oz.net
Fri Aug 23 23:20:05 CEST 2002


On Fri, 23 Aug 2002 07:00:03 -0400, "Mr. Neutron" <nicktsocanos at charter.net> wrote:
[...]
>
>I have thought of a new strategy for this world that does not need such a
>huge array but still can be used to create big worlds with it.
>
>See yah

"worlds" suggests that you are modeling some kind of virtual "world" environment,
e.g., the "world" of a game?

Why don't you start with the assumption that your "world" will be represented as
an instance of a class? E.g., class World. Then start thinking about what methods
it will need for you do do things with it. How do you want to talk to it about
things involving the (n,m) tuples you were talking about? What do they signify?
What do the indices to your monster array signify? Maybe you don't need an array
at all? E.g., maybe you need a database that can extract records defined by two-dimensional
coordinate limits instead? Never mind the representation at the start (ok, mention
your new strategy, but don't get bogged down in premature optimization of a premature
design decision ;-)

Try defining a bunch of method stubs (i.e., just use "pass" or a print statement for
the bodies, but specify the name and arg list, and supply a simple doc string) for your
class World. Then post. People will get an inkling of what you are trying to do, and will
be able to be much more helpful.

Regards,
Bengt Richter



More information about the Python-list mailing list