Package schlachtfeld :: Module pmw6
[hide private]
[frames] | no frames]

Source Code for Module schlachtfeld.pmw6

 1  #!/bin/env python 
 2  # This Python file uses the following encoding=utf-8 
 3   
 4  # Schlachtfeld - Großkämpfe im EWS System 
 5  #   http://rpg-tools-1d6.sf.net 
 6  # Copyright © 2007 - 2007 Achim Zien 
 7   
 8  # This program is free software; you can redistribute it and/or modify 
 9  # it under the terms of the GNU General Public License as published by 
10  # the Free Software Foundation; either version 2 of the License, or 
11  # (at your option) any later version. 
12   
13  # This program is distributed in the hope that it will be useful, 
14  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  # GNU General Public License for more details. 
17   
18  # You should have received a copy of the GNU General Public License 
19  # along with this program; if not, write to the Free Software 
20  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 
21  # MA 02110-1301 USA 
22   
23   
24  #### IMPORTS #### 
25  from random import randint as rnd 
26  #### IMPORTS #### 
27   
28   
29  #### FUNCTIONS #### 
30   
31 -def pmw6():
32 tmp = rnd(0,5) 33 count = 1 34 if tmp in [0,5]: 35 while tmp == rnd(0,5): 36 count += 1 37 wurf = count*ews[tmp] 38 return wurf
39
40 -def check(skill, MW):
41 if skill + pmw6() >= MW: 42 return 1 43 else: 44 return 0
45
46 -def ocheck(skill, MW):
47 return skill + pmw6() - MW
48 49 #### FUNCTIONS #### 50 51 52 #### GAME PARS #### 53 ews = [-5, -3, -1, 2, 4, 6] 54 #### GAME PARS #### 55 56 57 #### SELF CHECK #### 58 if __name__ == '__main__': 59 store = [] 60 for i in range(100000): 61 store.append(pmw6()) 62 print 'min max' 63 print min(store), max(store) 64 #### SELF CHECK #### 65