-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjankenpon.py
61 lines (54 loc) · 2.77 KB
/
jankenpon.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
54
55
56
57
58
59
60
61
# Use the button to play jankenpon (rock paper scissors, in Japanese)
import random
cube.set_all(black)
gu = [[black, black, black, black, black, black, black, black],
[black, black, black, black, black, black, black, black],
[black, white, blue, white, white, white, white, black],
[black, white, blue, white, white, white, white, black],
[black, black, white, white, white, white, white, black],
[black, black, white, white, white, white, white, black],
[black, black, black, black, white, white, white, black],
[black, black, black, black, black, black, black, black]]
choki = [[black, black, black, black, black, black, black, black],
[black, black, white, black, white, black, black, black],
[black, black, white, black, white, black, black, black],
[black, black, white, white, white, white, black, black],
[black, black, white, white, white, white, black, black],
[black, black, blue, white, white, white, white, black],
[black, black, black, white, white, white, white, black],
[black, black, black, black, black, black, black, black]]
pa = [[black, black, black, black, black, black, black, black],
[black, black, white, blue, white, blue, white, black],
[black, black, white, blue, white, blue, white, black],
[black, black, white, blue, white, blue, white, black],
[black, white, white, white, white, white, white, black],
[black, white, white, white, white, white, white, black],
[black, black, black, black, white, white, white, black],
[black, black, black, black, black, black, black, black]]
while True:
if buttons.top_pressed == 1:
#JAN
cube.set_all(green)
speaker.say("jan")
#KEN
cube.set_all(yellow)
speaker.say("ken")
#PON
cube.set_all(black)
randNumber = random.randint(0, 2)
if(randNumber == 0):
cube.set_panel(0, gu)
cube.set_panel(1, gu)
cube.set_panel(2, gu)
elif(randNumber == 1):
cube.set_panel(0, choki)
cube.set_panel(1, choki)
cube.set_panel(2, choki)
elif(randNumber == 2):
cube.set_panel(0, pa)
cube.set_panel(1, pa)
cube.set_panel(2, pa)
speaker.say("pon")
time.sleep(3)
else:
cube.set_all(black)