On Wed, Nov 21, 2012 at 1:18 PM, <frednot...@hotmail.ca> wrote: > Each time the player goes from 'Foo' to 'Bar' (or vice versa), make_map > randomly generates a new layout for either level. > > What I'd like to do is select values from 'levelSeed' and assign them to the > levels that make_map generates so that the player goes back to the same 'Foo' > and 'Bar' each time (at least until the player repopulates levelSeed with new > values by whatever method I eventually decide to use).
The easiest way would be to retain a mapping of seeds, eg: seeds = {'Foo': 142857, 'Bar': 271828} And then you reseed the random number generator with seeds[level] each time. (If your levels are identified by consecutive integers starting from 0 or 1, you could use a list instead of a dictionary, but the same applies.) However, this still means that the player will see the exact same level regenerated every time, absolutely fresh. As previously stated in this thread, that's not usually a good thing for encounters, treasure, etc. Once some nasty critter has been killed, he should STAY killed! :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list