-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrn.py
53 lines (44 loc) · 1.32 KB
/
rn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import random
dice6 = random.randint(1,6)
dice20 = random.randint(1,20)
coin = random.randint(1,2)
rps = random.randint(1,3)
def heads_tails() :
if (coin == 1) :
return "You got heads."
else :
return "You got tails."
ht_var = heads_tails()
def rock_paper_scissors() :
if (rps == 1) :
return "You got rock."
elif (rps == 2) :
return "You got paper."
else :
return "You got scissors."
rps_var = rock_paper_scissors()
def choiceFCN(event):
say("You chose " + event.value + ".")
if (event.value == "1") :
say("You rolled a " + str(dice6) + ".")
elif (event.value == "2") :
say("You rolled a " + str(dice20) + ".")
elif (event.value == "3") :
say(ht_var)
else :
say(rps_var)
def badChoiceFCN(event):
say("I'm sorry, I didn't understand that. Please try again.")
def the_ask() :
ask("Welcome to the chance facilitator. Select 1 for six sided dice, 2 for twenty sided dice, 3 for a coin flip, 4 for rock paper scissors.", {
"choices":"1(one, 1), 2(two, 2), 3(three, 3), 4(four, 4)",
"timeout":60.0,
"attempts":3,
"onChoice": choiceFCN,
"onBadChoice": badChoiceFCN
})
if(currentCall.initialText is not None) :
ask("", {"choices":"[ANY]"})
the_ask()
else :
the_ask()