parent:
ca0aa0efce7d42603bbd58644254b69e28eb2f99
Nick Mykins <nick@nick-mykins.local>
2012-09-27T15:14:34-04:00
made spin function randomize itself, accept no arguments
diff --git a/cli.pyc b/cli.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e86615c44988ad540aaf04a8b792163d7cdbb7bf Binary files /dev/null and b/cli.pyc differ diff --git a/machine.py b/machine.py index 9162c28bd7786cb4a8ead104393169ee4bff3ad4..6388d79be3c5dc3a6bacce991d3f0e214dc1a18d 100755 --- a/machine.py +++ b/machine.py @@ -1,6 +1,5 @@ import sys import os -import random import reels class Machine: @@ -22,11 +21,7 @@ def gamble(self): if self.balance <= 0: self.isBroke() else: - reelA = int(random.random()*100) - reelB = int(random.random()*100) - reelC = int(random.random()*100) - - win = reels.spin(reelA, reelB, reelC) + win = reels.spin() self.balance += self.bet * (win - 1) if win > 0: diff --git a/machine.pyc b/machine.pyc new file mode 100644 index 0000000000000000000000000000000000000000..899662bd020565b150d915b9100d2ddb1a80f78c Binary files /dev/null and b/machine.pyc differ diff --git a/reels.py b/reels.py index 960c5588db3fe371f35a88547345aa5c359d65ee..460c5ffb15d95eb13f588df0c129014d97479286 100755 --- a/reels.py +++ b/reels.py @@ -1,12 +1,13 @@ import time +import random # By changing the "pictures" on the reel, you can make the slot machine whatever theme you want. For example, reel = ['CHAT','CHIEN','ARBRE','MAISON','VILLE','MERDE'] has a French theme. reel = ['LEMON','CHERRY','ORANGE','WATERMELON','PINEAPPLE','GARBAGE'] -def spin(A,B,C): +def spin(): reelPics = ['','',''] - reelList = [A,B,C] + reelList = [int(random.random()*100), int(random.random()*100), int(random.random()*100)] payout = 0 # The probabilities of getting the six pictures are 30%, 25%, 15%, 10%, 5%, and 15%, respectively. diff --git a/reels.pyc b/reels.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6a90418bcaa36ada886d85b224ecf6bdcd9ad9a2 Binary files /dev/null and b/reels.pyc differ