crwdns258346:0crwdne258346:0
crwdns258348:0crwdne258348:0
crwdns258350:0crwdne258350:0
crwdns258354:0crwdne258354:0
- crwdns258356:0crwdne258356:0 crwdns258358:0crwdne258358:0
- crwdns258360:0crwdne258360:0
- crwdns258362:0crwdne258362:0
- crwdns258364:0crwdne258364:0 crwdns258366:0crwdne258366:0
- crwdns258368:0crwdne258368:0 crwdns258370:0crwdne258370:0 crwdns258372:0crwdne258372:0 crwdns258374:0crwdne258374:0
- crwdns258376:0crwdne258376:0 crwdns258378:0crwdne258378:0
- crwdns258380:0crwdne258380:0
- crwdns258382:0crwdne258382:0 crwdns258384:0crwdne258384:0 crwdns258386:0crwdne258386:0
- crwdns258388:0crwdne258388:0
crwdns258390:0crwdne258390:0
- crwdns258392:0crwdne258392:0
- crwdns258394:0crwdne258394:0
- crwdns258396:0crwdne258396:0
- crwdns258398:0crwdne258398:0
crwdns258400:0crwdne258400:0
1from microbit import *
2import radio
3import random
4
5radio.config(group=42)
6players = 3
7ID = 3
8display.show(ID)
9if ID == 1:
10 hasDuck = True
11else:
12 hasDuck = False
13radio.on()
14
15while True:
16 message = radio.receive()
17 if accelerometer.was_gesture('shake'):
18 if hasDuck:
19 sendTo = random.randint(1, players)
20 if sendTo != ID:
21 display.clear()
22 radio.send(str(sendTo))
23 if message:
24 if message == str(ID):
25 hasDuck = True
26 display.show(Image.DUCK)
27 else:
28 hasDuck = False
29
crwdns258402:0crwdne258402:0
- crwdns258404:0crwdne258404:0
- crwdns258406:0crwdne258406:0 crwdns258408:0crwdne258408:0 crwdns258410:0crwdne258410:0
- crwdns258412:0crwdne258412:0 crwdns258414:0crwdne258414:0 crwdns258416:0crwdne258416:0
This content is published under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) licence.