8 - 3 DT8 Python Microbits - Diff
8 - 3 DT8 Python Microbits - Diff
In this assessment task, students will complete 2 major activities, the second in a group of 2.
Students on their own will be following an online course (DT Challenge - Sport + micro:bit (Python), and solving
problems on the Grok Learning website. During this time, students may take notes, that will enable them to complete
the second part of the assessment more efficiently. Start here: https://groklearning.com/course/aca-dt-78-py-microbit-
sport/ (Python) or https://groklearning.com/course/aca-dt-56-bk-microbit-sport/ (Blockly).
For the second activity, students are to code in s small group of 2 (using Python and the micro:bit or Blockly) a special
game of rock, paper, scissors:
Rock, paper, scissors is a classic game of chance for two people. You and a partner shake your fists 3 times
and then make gestures at random to show a rock, paper or scissors. Rock beats scissors, scissors beat
paper and paper beats rock (it wraps the rock!).
When the micro:bit accelerometer detects a shake movement, it sets the variable tool to a random
number: 0, 1 or 2.
We use 0 because computers start counting at 0, and it’s good to remember that 0 is a number!
The program uses selection to decide what image to show on the LED display. If the random number was
0, it shows a rock icon, if it was 1 it shows the icon representing paper. If it wasn’t 0 or 1, it must be 2
because we instructed the micro:bit to only pick random numbers between 0 and 2, so in that case it
shows scissors.
URL https://microbit.org/projects/make-it-code-it/rock-paper-scissors/?editor=makecode
Marking Criteria.
vii. Modifies the game in a creative way by adding an additional minimum 2 functions
or set of features. Eg. keeping track of wins and losses, changing the game to best
of 3 for the win, allowing user to set their own team icon? Clearing the game of all
wins and losses, allowing a 3rd player into the game, giving the user a random
fortune message if they win etc
Student Group Names: /20
Note: By using Blockly a maximum grade of 15/20 will be awarded. Using
Python the maximum grade is not limited ie 20/20.
PART 2:
A. Explain what changes you made to the original program and why:
I added Sound for every time you shake and then I added text and rewards at the end to make it more
fun, and so you can play with different people
B. Insert a screenshot of your code below and upload the (p.y or hex) file code to compass: If using
blockly download or screenshot your code using SNIP tool and insert the screenshot here.
def on_button_pressed_a():
basic.show_icon(IconNames.HAPPY)
input.on_button_pressed(Button.A, on_button_pressed_a)
def on_button_pressed_b():
basic.show_icon(IconNames.SAD)
input.on_button_pressed(Button.B, on_button_pressed_b)
def on_gesture_shake():
global Hand
basic.show_string("Best of 3 Paper, Scissors, Rock", 95)
Hand = randint(1, 3)
if Hand == 1:
music.play_sound_effect(music.create_sound_effect(WaveShape.SINE,
5000,
0,
255,
0,
500,
SoundExpressionEffect.NONE,
InterpolationCurve.LINEAR),
2022 - Differentiated
SoundExpressionPlayMode.UNTIL_DONE)
basic.show_leds("""
# # # # #
# . . . #
# . . . #
# . . . #
# # # # #
""")
elif Hand == 2:
music.play_sound_effect(music.create_sound_effect(WaveShape.SINE,
5000,
0,
255,
0,
500,
SoundExpressionEffect.NONE,
InterpolationCurve.LINEAR),
SoundExpressionPlayMode.UNTIL_DONE)
basic.show_leds("""
. . . . .
. # # # .
. # # # .
. # # # .
. . . . .
""")
else:
music.play_sound_effect(music.create_sound_effect(WaveShape.SINE,
5000,
0,
255,
0,
500,
SoundExpressionEffect.NONE,
InterpolationCurve.LINEAR),
SoundExpressionPlayMode.UNTIL_DONE)
basic.show_leds("""
# # . . #
# # . # .
. . # . .
# # . # .
# # . . #
""")
basic.show_string("If you won press A if you lost press B", 60)
input.on_gesture(Gesture.SHAKE, on_gesture_shake)
Hand = 0
radio.set_group(1)
basic.show_string("Welcome To The Tournament of Champions", 50)
def on_forever():
pass
basic.forever(on_forever)