.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $6.00

   







Go Back   .com.unity Forums > Illwinter Game Design > Dominions 3: The Awakening

Reply
 
Thread Tools Display Modes
  #1  
Old October 9th, 2007, 10:06 AM
Horst F. JENS's Avatar

Horst F. JENS Horst F. JENS is offline
Sergeant
 
Join Date: Oct 2003
Location: Vienna, Austria, Europe
Posts: 234
Thanks: 62
Thanked 11 Times in 6 Posts
Horst F. JENS is on a distinguished road
Default 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.

Code:

# 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])



Reply With Quote
  #2  
Old October 9th, 2007, 05:26 PM
WraithLord's Avatar

WraithLord WraithLord is offline
General
 
Join Date: Sep 2003
Location: Tel Aviv, Israel
Posts: 3,465
Thanks: 511
Thanked 162 Times in 86 Posts
WraithLord is on a distinguished road
Default 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
Reply With Quote
  #3  
Old October 10th, 2007, 02:40 AM
Horst F. JENS's Avatar

Horst F. JENS Horst F. JENS is offline
Sergeant
 
Join Date: Oct 2003
Location: Vienna, Austria, Europe
Posts: 234
Thanks: 62
Thanked 11 Times in 6 Posts
Horst F. JENS is on a distinguished road
Default Re: python program: DRN (2x open-ended D6 dice)

cool! Let us resurrect the old DomPPP combat simulator :-)
Reply With Quote
  #4  
Old October 10th, 2007, 03:05 AM
Zylithan's Avatar

Zylithan Zylithan is offline
Sergeant
 
Join Date: Aug 2007
Posts: 379
Thanks: 0
Thanked 1 Time in 1 Post
Zylithan is on a distinguished road
Default Re: python program: DRN (2x open-ended D6 dice)

combat simulator.... yes please!
Reply With Quote
  #5  
Old October 10th, 2007, 04:17 AM
WraithLord's Avatar

WraithLord WraithLord is offline
General
 
Join Date: Sep 2003
Location: Tel Aviv, Israel
Posts: 3,465
Thanks: 511
Thanked 162 Times in 86 Posts
WraithLord is on a distinguished road
Default 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.
Reply With Quote
  #6  
Old October 10th, 2007, 04:23 PM
Morkilus's Avatar

Morkilus Morkilus is offline
Major
 
Join Date: Aug 2004
Location: Salt Lake City
Posts: 1,032
Thanks: 0
Thanked 1 Time in 1 Post
Morkilus is on a distinguished road
Default Re: python program: DRN (2x open-ended D6 dice)

I miss Saber Cherry.
Reply With Quote
  #7  
Old October 10th, 2007, 04:24 PM
NTJedi's Avatar

NTJedi NTJedi is offline
General
 
Join Date: Jun 2003
Location: az
Posts: 3,069
Thanks: 41
Thanked 39 Times in 28 Posts
NTJedi is on a distinguished road
Default Re: python program: DRN (2x open-ended D6 dice)

Quote:
Morkilus said:
I miss Saber Cherry.
I miss The Paladin... he did some great tools.
__________________
There can be only one.
Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 03:33 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.