Thread: Pyrel dev log
View Single Post
Old June 8, 2012, 11:58   #65
Angband Devteam member
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Originally Posted by emulord View Post
You dont need a million entries, just have the entries be like
[ (1, The One Ring's ID number),
(100000, Lembas wafer's ID) ...]

And when you generate the random item number you subtract the allocation value of the first entry, then move on to the next until allocation value > random number. Then you found your item. To speed it up put larger numbers up front.
We are violently agreeing with each other. I didn't mean you need a million items in a python dict, I meant that the conceptual number line / allocation table has one entry for The One Ring and a million entries for a Ration of Food (or whatever).

P.S. Derakon: we've reached the point where this thread no longer displays nicely in the Oook software (it says "More replies below current depth" and requires extra clicks and scrolling) - so please could you start a new thread? Thanks.
"3.4 is much better than 3.1, 3.2 or 3.3. It still is easier than 3.0.9, but it is more convenient to play without being ridiculously easy, so it is my new favorite of the versions." - Timo Pietila
Magnate is offline   Reply With Quote