[Tutor] my text adventure, saving and restoring

david din22 at earthlink.net
Mon Dec 5 03:04:22 CET 2005

thanks that was very helpful. i added all that stuff because i was 
trying to figure out some way of getting at the descriptions and exits.
that is the part i'm stuck on. but knowing that world is all i need is 
good because i can focus my efforts better. thanks.

> You could make your save() method a lot simpler; something like this:
>    def save(self):
>        f = open('savefile', 'w')
>        pickle.dump(world,f)
>        f.close()
> This is all you need, because 'world' contains all the information
> about your world.  Then, when you load the data back, you will need to
> figure out some way of building your 'rooms' data structure from
> 'world'.
> Does this help?
> --
> John.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list