Mission 1 Zombie Detector

Circuit Playground Express

Here’s the algorithm I gave you for your first challenge with the Circuit Playground Express:

On Start 
  Show all red lights
When Pin is touched then
  Person is human!
  Show all green lights
  Pause for 3 seconds
  Clear the lights
Show all red lights

micro:bit

Your first Expert Level challenge! How did it go? This was the algorithm I gave you to work on:

And this is what I came up with as an answer

On Start 
 Show a Cross
When Pin is touched then 
 Person is human!
 Show a Tick
 Pause for 3 seconds
 Clear the screen
 Show a Cross

Raspberry Pi

I gave you an algorithm to use the turtle library to draw a cross and tick on the screen. Here’s the algorithm:

On Start
   Show a Cross
If Pin is touched then
   Person is human! Show a tick
   Pause for 3 seconds
   Clear the screen
   Show a cross

And here’s my code to solve the problem. But I bet you could improve it!

import time
import turtle
from savetheworld import touch


#setup the arrow
myArrow = turtle.Turtle()
myArrow.color("blue")
myArrow.pensize(20)

#draw a cross
myArrow.left(45)
myArrow.forward(100)
myArrow.penup()
myArrow.left(135)
myArrow.forward(71)
myArrow.left(135)
myArrow.pendown()
myArrow.forward(100)

while True:
    phatStatus = touch.touched("Any")
    if phatStatus:
        print ("Button pressed")
        #draw a tick

        #clear the screen
        myArrow.clear()
        
        #draw a tick
        myArrow.left(180)
        myArrow.forward(50)
        myArrow.backward(50)
        myArrow.right(90)
        myArrow.forward(100)

        #pause for 3 seconds
        time.sleep(3)

        #clear the screen
        myArrow.clear()

        #show a cross
        myArrow.left(45)
        myArrow.forward(100)
        myArrow.penup()
        myArrow.left(135)
        myArrow.forward(71)
        myArrow.left(135)
        myArrow.pendown()
        myArrow.forward(100)