![]() |
python program: DRN (2x open-ended D6 dice)
The manual on page 5 explain very good the DRN (open-ended-dice) system.
So i made a small python script to test it out. Improved my knowlege about the game's random numbers, maybe it is useful for others too. you need python from http://www.python.org to run this script. <font class="small">Code:</font><hr /><pre> # works like a normal dice, but you can throw the dice again # if the dice rolls the highest possible number. # If the dice rolls the highest possible number, the number will be added, then # 1 will be substracted and the dice rolls again. # allows (theoretical) extremly highs values, but only in extrem rare situations import random def domdice(sides=6): "rolls a dice. sides must be > 1" if sides < 2: raise SystemExit sum = 1 dice = sides while dice == sides: sum -=1 dice = random.randint(1,sides) sum += dice return sum #-------- try it out ------ results = {} for x in xrange(10000): roll = domdice()+domdice() if roll in results: results[roll] += 1 else: results[roll] = 1 for key in range(1,max(results),1): if key in results: print "%d %d" % (key, results[key]) </pre><hr /> |
Re: python program: DRN (2x open-ended D6 dice)
Thanks!
It is in my to do list to use python in order to write a combat simulator from dominions. I have already done some nice things with python such as py_eye (like gods eye from dom-II), and an automatic PBEM manager but unfortunately I still haven't started working on the combat sim http://forum.shrapnelgames.com/images/smilies/frown.gif |
Re: python program: DRN (2x open-ended D6 dice)
cool! Let us resurrect the old DomPPP combat simulator :-)
|
Re: python program: DRN (2x open-ended D6 dice)
combat simulator.... yes please!
|
Re: python program: DRN (2x open-ended D6 dice)
Very well then. I'll make it my next project, right after I complete my personal search engine I'll start on the combat simulator.
|
Re: python program: DRN (2x open-ended D6 dice)
I miss Saber Cherry. http://forum.shrapnelgames.com/images/smilies/frown.gif
|
Re: python program: DRN (2x open-ended D6 dice)
Quote:
|
All times are GMT -4. The time now is 06:26 AM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.