# Rock, paper, scissors: a free micro:bit lesson from Maze Education
# https://maze.education/microbit/lessons/rock-paper-scissors
# MicroPython for the micro:bit Python Editor: https://python.microbit.org

# Rock, paper, scissors: shake to throw.
from microbit import *
import random

rock = Image("00000:09990:09990:09990:00000")
paper = Image("99999:90009:90009:90009:99999")

while True:
    if accelerometer.was_gesture("shake"):
        hand = random.randint(1, 3)
        if hand == 1:
            display.show(rock)
        elif hand == 2:
            display.show(paper)
        else:
            display.show(Image.SCISSORS)
    sleep(100)
