Une partie de pierre papier ciseaux, en secouant la carte :
from microbit import * import random PIERRE = Image("99999:" "90009:" "90009:" "90009:" "99999") CISEAU = Image('99009:' '99090:' '00900:' '99090:' '99009') PAPIER = Image('00000:' '00000:' '99999:' '00000:' '00000') while True: if accelerometer.is_gesture('shake'): tirage = random.randint(1,3) if tirage==1: display.show(PIERRE) if tirage==2: display.show(PAPIER) if tirage==3: display.show(CISEAU)
Aucune réponse