Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teacher Tool: Add Block Exist Criteria from Intro CS Curriculum #5644

Merged
merged 15 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 55 additions & 7 deletions docs/teachertool/catalog.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,66 @@
{
"criteria": [
{
"id": "35610CA0-38F8-4CCE-BAB9-99593DB3358A",
"use": "responds_to_events",
"template": "Responds to at least ${count} different events",
"description": "At least the specified number of event blocks are present.",
"docPath": "/teachertool",
"maxCount": 1,
"params": [
{
"name": "count",
"type": "number",
"default": 1,
"paths": ["checks[0].count"]
}
]
},
{
"id": "3F7A9DB3-0B5E-456B-86E7-79573F9F6E53",
"use": "uses_input",
"template": "Uses input",
"description": "At least one block that reads or reacts to user input is present.",
"docPath": "/teachertool",
"maxCount": 1
},
{
"id": "D285D79B-85E5-4C8D-82D2-5A9E35AB1163",
"use": "output_to_led_display",
"template": "Outputs to the LED display",
"description": "Uses at least one block that lights up LEDs",
"use": "has_output",
"template": "Produces output",
"description": "At least one block that lights up LEDs, makes sound, or writes to pins is present.",
"docPath": "/teachertool",
"maxCount": 1
},
{
"id": "2CA4A5DA-4690-4514-97F5-2FE145AB3A59",
"use": "uses_led_coordinates",
"template": "Uses LED coordinates at least ${count} times",
"description": "Uses blocks that reference LED coordinates at least the specified number of times.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a description for this criteria? It seems that the description for this is very similar to the template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to default to including descriptions, even if they feel a bit redundant. In this case, I think it's helpful to specify that we're looking specifically for blocks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, makes sense. I find that "reference" is a bit of a confusing word to use here, would changing it with "access" or "check" still make sense for this description?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm "access" and "check" don't quite convey the correct meaning, in my mind. Perhaps "Uses blocks that accept LED coordinate inputs at least the specified number of times"?

"docPath": "/teachertool",
"maxCount": 1,
"params": [
{
"name": "count",
"type": "number",
"default": 1,
"paths": ["checks[0].count"]
}
]
},
{
"id": "BBB47818-B35F-404C-89A1-D6A594CE9E30",
"use": "sends_radio_message",
"template": "Sends radio messages",
"description": "Radio group is set and at least one block that sends a radio message is present.",
"docPath": "/teachertool",
"maxCount": 1
},
{
"id": "C57344FC-B915-4ACB-A070-67F8FFC18B4B",
"use": "read_gpio_pin",
"template": "Read a GPIO pin",
"description": "Read input from one or more of the microbit GPIO pins.",
"id": "8C8792C4-31C4-439D-ACAB-C99C9B8250AD",
"use": "receives_radio_message",
"template": "Receives radio messages",
"description": "Radio group is set and at least one block that listens for radio messages is present.",
"docPath": "/teachertool",
"maxCount": 1
},
Expand Down
181 changes: 144 additions & 37 deletions docs/teachertool/validator-plans.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
{
".desc": "Shows something on the LED screen.",
"name": "output_to_led_display",
"name": "has_output",
"threshold": 1,
"checks": [
{
Expand All @@ -33,70 +33,177 @@
"device_plot_bar_graph",
"device_plot_brightness",
"device_show_image_offset",
"device_scroll_image"
"device_scroll_image",

"game_create_sprite",
"game_game_over",
"game_add_score",
"game_remove_life",
"game_start_countdown",

"music_playable_play",
"device_ring",
"music_playable_play_default_bkg",

"device_set_digital_pin",
"device_set_servo_pin"
],
"count": 1
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "game_set_life",
srietkerk marked this conversation as resolved.
Show resolved Hide resolved
"count": 1
}
],
"childValidatorPlans": ["number_zero"]
}
]
},
{
".desc": "Read input from a GPIO pin.",
"name": "read_gpio_pin",
".desc": "Processes input in any form (TODO : Non-Empty Check for event blocks)",
"name": "uses_input",
"threshold": 1,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "device_pin_event",
"count": 1
}
]
},
"validator": "blocksInSetExist",
"blocks": [
"control_on_event",
"device_button_event",
"device_gesture_event",
"device_pin_event",
"device_pin_released",
"input_logo_event",
"input_on_sound",
"pins_on_pulsed",
"radio_on_number_drag",
"radio_on_string_drag",
"radio_on_value_drag",
"serial_on_data_received",

"device_acceleration",
"device_get_analog_pin",
"device_get_button2",
"device_get_digital_pin",
"device_get_light_level",
"device_get_magnetic_force",
"device_get_rotation",
"device_get_running_time",
"device_get_running_time_micros",
"device_get_sound_level",
"device_heading",
"device_pin_is_pressed",
"device_temperature",
"deviceisgesture",
"input_logo_is_pressed",
"music_sound_is_playing",
"pins_i2c_readnumber",
"pins_pulse_duration",
"pins_pulse_in",
"serial_read_buffer",
"serial_read_line",
"serial_read_until",
"serial_readbuffer"
],
"count": 1
}
]
},
{
".desc": "Runs code in response to any event (TODO : Non-Empty Check)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to ask a clarifying question for the difference between this validator and the uses_input validator. Is this validator looking at all of the open-mouthed "on-x-..." blocks and the uses_input validator looking at those blocks AND all the blocks that access something from the micro:bit board?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More or less. uses_input is any kind of input (buttons, sound, etc...) and includes things like the "compass heading" and "sound level" blocks which aren't events.

This one is looking at any "event" (i.e. most of the open-mouthed) blocks, even ones which are not necessarily "inputs" (specifically, "music on [melody note played]").

"name": "responds_to_events",
"threshold": 1,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "device_pin_is_pressed",
"count": 1
}
]
},
"validator": "blocksInSetExist",
"blocks": [
"control_on_event",
"device_button_event",
"device_gesture_event",
"device_pin_event",
"device_pin_released",
"input_logo_event",
"input_on_sound",
"melody_on_event",
"pins_on_pulsed",
"radio_on_number_drag",
"radio_on_string_drag",
"radio_on_value_drag",
"serial_on_data_received"
],
"count": 0
}
]
},
{
".desc": "Checks for blocks that reference LEDs by their coordinates",
"name": "uses_led_coordinates",
"threshold": 1,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "device_pin_released",
"count": 1
}
]
},
"validator": "blocksInSetExist",
"blocks": [
"device_plot",
"device_led_toggle",
"device_unplot",
"device_point",
"device_plot_brightness",
"device_point_brightness",
"game_create_sprite"
],
"count": 0
}
]
},
{
".desc": "Checks that radio group is set and at least one radio send message block is present",
"name": "sends_radio_message",
"threshold": 2,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "device_get_digital_pin",
"blockId": "radio_set_group",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm forgetting, did we set up the infrastructure to put validator plans in with the checks? That might be something interesting to think about going forward if not, but I'm just thinking out loud and it might not be worth the effort. This validator and the inputs and events validators made me think about this where we could split out some of the shared checks into a different validator, then list that validator as one of the checks. So in this case, you could put the radio_set_group check in a separate validator and then use that validator in the sends_radio_message and receives_radio_message to cut down on duplicates.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, something like that might be helpful, but we don't support it yet, and it'd be nontrivial to implement. There'd be some potentially-complicated design implications to deal with and I didn't want to get into that mess in this change.

"count": 1
}
]
},
{
"validator": "blocksInSetExist",
"blocks": [
"radio_datagram_send",
"radio_datagram_send_value",
"radio_datagram_send_string"
],
"count": 1
}
]
},
{
".desc": "Checks that radio group is set and at least block that listens for radio messages is present. (TODO : Non-Empty Check)",
"name": "receives_radio_message",
"threshold": 2,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "device_get_analog_pin",
"blockId": "radio_set_group",
"count": 1
}
]
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "pins_on_pulsed",
"count": 1
}
]
"validator": "blocksInSetExist",
"blocks": [
"radio_on_number_drag",
"radio_on_value_drag",
"radio_on_string_drag"
],
"count": 1
}
]
},
Expand Down
Loading