Categories
Travel

Bop It! Python Programming Game

This was my fourth time going to Girls Programming Network Perth at University of Western Australia and this was by far the most fun!

Main Project: Bop It!

This GPN we were making our very own game of ‘Bop It’ using BBC Micro:bits.

‘Bop It’ is a electronic game toy which commands the person playing to take a set of actions in a random order.

BBc Microcontroller that I used

We made our own version using BBC Micro:bit V2 and it was truly fascinating. This GPN was different as this time we used microcontrollers and physical circuits. However, juts like the previous GPN’s there were different classes depending on which level of coding you were comfortable with. Each level had interesting names like Baymax, BB-8, Eve and Wall-E.

I was in team BB-8 and we used the website python.micro:bit.org to code the instructions for the game.

This is the final code for the game after many trial and errors:

# Done by Ahla in 23/11/24 GPN

# Imports go at the top
from microbit import *
import music
import random

#Part 1
display.show(Image.TARGET)
sleep(1000)
display.clear()

#Part 2
actions = ["press a", "press b"]
action = random.choice(actions)
print(action)

#Part 3 & 4 & 5 & 6
start_time = running_time()
end_time = start_time+10000
score = 0

    
while running_time() < end_time:
    if accelerometer.was_gesture('shake'):
        display.show(Image.CONFUSED)
    if action == "press a":
       display.show(Image.ARROW_W)
       if button_a.is_pressed():
            display.show(Image.HAPPY)
            score = score + 1
            music.play("A:2",wait = False)
       else: continue
    
    if action == "press b":
        display.show (Image.ARROW_E)
        if button_b.is_pressed():
            display.show(Image.HEART)
            score = score + 1
            music.play("B:2",wait = False)
        else: continue
            
    sleep(500)
    action = random.choice(actions)

##final_score = 5
display.scroll(str(score))

The code could be sent to the micro:bit by clicking on ‘send to micro:bit’ at the bottom of the website. Before sending the code make sure the micro:bit is connected to your laptop using a cable.

Alternatively, if you do not have a physical micro:bit to play with, you could also click on the micro:bit illustration on the top right of the website to play on screen.

This was by far the most fun I had coding at GPN probably because I could see the result live on the BBC micro:bit.

Chill Time: Squishy Circuits

During our 1 hour after lunch time we did a no laptop game which involved lots of play doh and electric circuits!

We tried to make our very own squishy snail which had illuminating LED for its eyes. The circuits were connected with play doh to carry electricity.

It was so cool to try and we did different things like flowers, dinosaurs and dogs. You could try some other cool projects at: Squishy Circuits website.

The GPN session helped me learn more coding and I would like to thank the GPN tutors who helped me Sheree Pudney, Michelle, Sanjana, Ella, Jyothi, Luara, Shuray and others. They helped me tackle challenges in coding and make the overall experience more thrilling.

GPN also provides workbooks, presentation slides and cheat sheets to help you with coding. It can be accessed from: https://www.girlsprogramming.network/perth-workshop

Leave a Reply

Your email address will not be published. Required fields are marked *