• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# keno gambling

a guest Jan 25th, 2012 113 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. from random import shuffle
2.
3. class speele():
4.
5.     def __init__(self):
6.         self.masivs=[]
7.         self.chosen=[]
8.         self.uChosen=[]
9.         self.uzvara=0
10.
11.     def create(self):
12.
13.         for i in range (1,81):          #latvieshu keno loterijaa ir 62 skaitlji / latvian keno gambling we have 62 numbers
14.             self.masivs.append(i)       #ciklaa saliek skaitljus peec kaartas / this one creates array ascending
15.
16.
17.     def compare(self):                  #saliidzina lietotaaja izveeleetos skaitljus ar datora izveeleetajiem divos ciklos. /in two cycles comparing is needed
18.         for each in self.chosen:        #pirmais cikls panjem elementu(skaitli) peec kaartas no 20 datora izveeleetajiem skaitljiem /first one takes element and
19.             for eachs in self.uChosen:  #otrais cikls saliidzina visus cilveeka izveeleetos skaitljus ar doto datora esosho skaitli /compares with user given elements in the second cycle
20.                 if eachs==each:         #ja sakriit, tad saak skaitiit sakriitoshos skaitljus / if they are equal then catches are counted
21.                     self.uzvara=self.uzvara+1
22.
23.     def rerandom(self):                 #papildus funkcija, lai vareetu atkaartot speeli /this function allows to play again
24.         shuffle(self.masivs)            #samaisa masiivu kuraa visi 62 elementi /shuffles an array
25.         self.chosen=[]                  #izdzeesh vecos datus /deletes old chosen data
26.         self.uzvara=0                   #izdzeesh vecaas uzvaras /deletes count of old catches
27.         for each in range(1,21):        #izveelas pirmos 20 elementus no samaisiitaa masiiva /chooses again from shuffled array
28.             self.chosen.append(self.masivs[each])
29.             #print self.masivs[each]
30.
31.
32.
33. skaitlis=speele()               #definee objektu /creates object
34. skaitlis.create()               #izveido masiivu pirmajai reizei /creates an array
35. ########################################
36. skaitlis.uChosen=[8,15]              #izvēlies šeit / users put their choices here
37. ########################################
38. j=0
39.
40. for i in range (1,5):
41.     skaitlis.rerandom()         #katraa naakamajaa reizee ciklaa samaisa / loop allows to play multiple times. shuffling and resetting is needed
42.     skaitlis.compare()          #saliidzina atrastos ar izveeleeto /comparing
43.     if skaitlis.uzvara==len(skaitlis.uChosen):
44.         j=j+1                   #skaita uzvaras visaas speelees. /counting full wins in all games
45. print j
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top