Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33700
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.023 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; '(at': 0.03; '21,': 0.07; 'assign': 0.07; 'nasty': 0.07; 'integers': 0.09; 'subject:Getting': 0.09; 'thread,': 0.09; 'dictionary,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; "{'foo':": 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'previously': 0.18; '(or': 0.18; "i'd": 0.22; 'player': 0.23; 'random': 0.24; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'select': 0.26; 'values': 0.26; 'easiest': 0.27; 'message-id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'decide': 0.28; 'usually': 0.30; 'could': 0.32; 'goes': 0.33; 'retain': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'whatever': 0.35; 'identified': 0.35; 'mapping': 0.35; 'nov': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'level.': 0.36; 'method': 0.36; 'should': 0.36; 'level': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'stay': 0.61; 'back': 0.62; 'time,': 0.62; 'levels': 0.66; 'stated': 0.69; 'absolutely': 0.84; "'foo'": 0.84; 'fresh.': 0.84; 'seeds': 0.84; 'seeds,': 0.84; 'subject:value': 0.84; '1:18': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=rN4kCx26cZ6GWl79vpWlPMZcX8yVO0aTHbRh6k8ur2Q=; b=TVhZtf7CTPqsf0wYXlXbXaWvsfqgbTr/IcVrDps33DAPUn2pvZXSOVWqEzzbU06nmi h/8tQeRdfhYfB4exoYJjhL9vU4jNu+uyOehVqRkVHL5plFgZ6VO2LkhTY4CBT1Mz6DjS AzbjfYknkvamN2JvgGXtJSKppX3236efR0WO0S0YyTVzn/ddb47n/c0c3zkC601S5NJN IJlN6/rlorFljjuTe4YewtvtPKGqPB0mFLNVXxoY1Zx3iM0CK5VjlmuOWidwutWwxShx pQKb2mYePXozguFYHbERG/XSI/1vJe3c3xmDiXI1iXLwoAdVmdEi26RnO3LNkZ0qMzsp 7fRg== |
| MIME-Version | 1.0 |
| In-Reply-To | <993b9303-dbca-43f1-9ff4-9677278776b1@googlegroups.com> |
| References | <SNT139-W8C22F3D436702B17D7803A3560@phx.gbl> <mailman.17.1353367913.29569.python-list@python.org> <993b9303-dbca-43f1-9ff4-9677278776b1@googlegroups.com> |
| Date | Wed, 21 Nov 2012 14:41:24 +1100 |
| Subject | Re: Getting a seeded value from a list |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.128.1353469287.29569.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1353469287 news.xs4all.nl 6945 [2001:888:2000:d::a6]:49353 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:33700 |
Show key headers only | View raw
On Wed, Nov 21, 2012 at 1:18 PM, <frednotbob@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Getting a seeded value from a list Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-19 18:31 -0500
Re: Getting a seeded value from a list frednotbob@hotmail.ca - 2012-11-19 21:45 -0800
Re: Getting a seeded value from a list frednotbob@hotmail.ca - 2012-11-19 21:45 -0800
Re: Getting a seeded value from a list Nobody <nobody@nowhere.com> - 2012-11-20 08:26 +0000
Re: Getting a seeded value from a list frednotbob@hotmail.ca - 2012-11-20 18:18 -0800
Re: Getting a seeded value from a list Chris Angelico <rosuav@gmail.com> - 2012-11-21 14:41 +1100
Re: Getting a seeded value from a list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-21 03:47 +0000
Re: Getting a seeded value from a list Chris Angelico <rosuav@gmail.com> - 2012-11-21 15:00 +1100
RE: Getting a seeded value from a list "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-23 16:27 +0000
Re: Getting a seeded value from a list Chris Angelico <rosuav@gmail.com> - 2012-11-24 09:32 +1100
RE: Getting a seeded value from a list "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-26 20:17 +0000
Re: Getting a seeded value from a list Hans Mulder <hansmu@xs4all.nl> - 2012-11-27 02:01 +0100
Re: Getting a seeded value from a list Chris Angelico <rosuav@gmail.com> - 2012-11-27 07:24 +1100
Re: Getting a seeded value from a list frednotbob@hotmail.ca - 2012-11-20 18:18 -0800
Re: Getting a seeded value from a list Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-21 03:37 +0000
csiph-web