Skip to content

Commit

Permalink
Experiments with generic criteria, not actually for use. But some int…
Browse files Browse the repository at this point in the history
…eresting ideas... Lots of this should be moved to microbit, not shared.
  • Loading branch information
thsparks committed Mar 7, 2024
1 parent 048760b commit 00ca673
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 35 deletions.
133 changes: 98 additions & 35 deletions common-docs/teachertool/catalog-shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,129 @@
"criteria": [
{
"id": "B3FD8B3D-61B4-42F4-B0EF-64BD7D62CDAB",
"use": "two_different_loops",
"template": "Two different kinds of loops used",
"use": "n_loops_used",
"template": "At least ${count} loops used",
"docPath": "/teachertool",
"description": "The program uses two different types of loops (for, repeat, while, or for-of)."
"description": "The program uses at least the specified number of loops (for, repeat, while, or for-of).",
"params": [
{
"name": "count",
"type": "number",
"default": 1,
"paths": ["checks[0].count"]
}
]
},
{
"id": "49262A2B-C02A-43A2-BAD5-FCAC6AE9D464",
"use": "custom_function_called",
"template": "A custom function exists and gets called",
"id": "15822AD7-EE67-4C95-BFB4-0BF86A976023",
"use": "n_inputs",
"template": "At least ${count} different inputs used",
"docPath": "/teachertool",
"description": "A user-defined function is created and called in the program."
"description": "The program supports at least this many forms of input (on button pressed, on shake, etc...).",
"params": [
{
"name": "count",
"type": "number",
"default": 1,
"paths": ["checks[0].count"]
}
]
},
{
"id": "76D86387-E3CF-4BEB-B62C-B811F5997631",
"use": "block_comment_used",
"template": "At least one block has comments",
"id": "DC564060-F177-46CC-A3AC-890CD8545972",
"use": "",
"template": "At least ${count} conditionals used",
"docPath": "/teachertool",
"description": "At least one code block has a comment attached to it."
"description": "The program uses if conditions at least the specified number of times.",
"params": [
{
"name": "count",
"type": "number",
"default": 1,
"paths": ["checks[0].count"]
}
]
},
{
"id": "8F97C9A6-CF16-48B4-A84F-3105C24B20DE",
"use": "functions_have_comments",
"template": "All function definitions have comments",
"id": "D21D76A2-D9FD-4F9B-B0AC-973CB870EA78",
"use": "n_variables_used_and_set",
"template": "At least ${count} custom variables set and used.",
"docPath": "/teachertool",
"description": "All user-defined functions in the program have comments attached to them."
"description": "At least one user-defined variable is set to a value.",
"params": [
{
"name": "count",
"type": "number",
"paths": ["checks[0].count", "checks[1].count"],
"default": 1
}
]
},
{
"id": "D21D76A2-D9FD-4F9B-B0AC-973CB870EA78",
"use": "variable_set",
"template": "At least one custom variable is set",
"id": "E62EE5E6-4FB2-4954-ADAF-57F8FECA21B8",
"use": "named_variable_used_and_set",
"template": "Variable named ${name} set and used",
"description": "A variable with the specified name is defined and used.",
"docPath": "/teachertool",
"description": "At least one user-defined variable is set to a value."
"params": [
{
"name": "name",
"type": "string",
"paths": ["checks[0].fieldValue", "checks[1].fieldValue"]
}
]
},
{
"id": "0173898D-8A48-4266-AAB9-CE934471A734",
"use": "variable_accessed",
"template": "At least one variable is accessed",
"id": "79D5DAF7-FED3-473F-81E2-E004922E5F55",
"use": "custom_function_called",
"template": "At least ${count} custom functions used",
"docPath": "/teachertool",
"description": "At least one variable's value is read."
"description": "At least this many user-defined functions are created and called.",
"params": [
{
"name": "count",
"type": "number",
"paths": ["checks[0].count", "checks[1].count"],
"default": 1
}
]
},
{
"id": "8E6F9A92-2D22-4BB0-A77A-BD7490D3CEF7",
"use": "variable_set_random",
"template": "A custom variable's value is set to a random number",
"id": "7AE7EA2A-3AC8-42DC-89DB-65E3AE157156",
"use": "block_comment_used",
"template": "At least ${count} comments",
"description": "The project contains at least the specified number of comments.",
"docPath": "/teachertool",
"description": "A user-defined variable has its value set to a random number."
"params": [
{
"name": "count",
"type": "number",
"default": 1,
"paths": ["checks[0].count"]
}
]
},
{
"id": "E8DAD360-F4AB-4E6B-9981-C14BDEE1295B",
"use": "device_random_used",
"template": "The 'pick random' block is used",
"id": "8F97C9A6-CF16-48B4-A84F-3105C24B20DE",
"use": "functions_have_comments",
"template": "All function definitions have comments",
"docPath": "/teachertool",
"description": "The 'pick random' block from the math category is used at least once."
"description": "All user-defined functions in the program have comments attached to them."
},
{
"id": "DC564060-F177-46CC-A3AC-890CD8545972",
"use": "num_compare_eq",
"template": "Compare two numbers for equality",
"id": "499F3572-E655-4DEE-953B-5F26BF0191D7",
"use": "ask_ai",
"template": "Ask Copilot: ${question}",
"description": "Warning: AI responses may not always be correct. Verify responses before sharing with students.",
"docPath": "/teachertool",
"description": "The program compares two numbers for equality at least once."
"params": [
{
"name": "question",
"type": "string",
"picker": "longString",
"paths": ["checks[0].question"]
}
]
}
]
}
20 changes: 20 additions & 0 deletions common-docs/teachertool/test/validator-plans-shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@
"count": 0
}
]
},
{
"id": "59AAC5BA-B0B3-4389-AA90-1E767EFA8563",
"use": "block_used_n_times",
"template": "${Block} used ${count} times",
"description": "This block was used the specified number of times in your project.",
"docPath": "/teachertool",
"params": [
{
"name": "block",
"type": "string",
"paths": ["checks[0].blockCounts[0].blockId"]
},
{
"name": "count",
"type": "number",
"default": 1,
"paths": ["checks[0].blockCounts[0].count"]
}
]
}
]
}
91 changes: 91 additions & 0 deletions common-docs/teachertool/validator-plans-shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,97 @@
]
}
]
},

{
".desc": "Loops used n times (to be filled in by the user)",
"name": "n_loops",
"threshold": 1,
"checks": [
{
"validator": "blocksInSetExist",
"blocks": ["controls_repeat_ext", "device_while", "pxt_controls_for", "pxt_controls_for_of"],
"count": 0
}
]
},
{
".desc": "Inputs are used n times",
"name": "n_inputs",
"threshold": 1,
"checks": [
{
"validator": "blocksInSetExist",
"blocks": [
"device_button_event",
"device_gesture_event",
"device_pin_event",
"device_get_button2",
"device_acceleration",
"device_pin_is_pressed",
"device_get_light_level",
"device_heading",
"device_temperature",
"deviceisgesture",

"input_on_sound",
"input_logo_event",
"input_logo_is_pressed",
"device_get_sound_level",

"device_get_magnetic_force",
"device_get_rotation",
"device_get_running_time",
"device_get_running_time_micros",
"device_pin_released"
],
"count": 0
}
]
},
{
".desc": "A custom function exists and gets called",
"name": "n_variables_used_and_set",
"threshold": 2,
"checks": [
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "variables_set",
"count": 0
}
]
},
{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "variables_get",
"count": 0
}
]
}
]
},
{
".desc": "A custom function exists and gets called",
"name": "named_variables_used_and_set",
"threshold": 2,
"checks": [
{
"validator": "blockFieldValueExists",
"fieldType": "VAR",
"fieldValue": "",
"blockType": "variables_get"
},
{
"validator": "blockFieldValueExists",
"fieldType": "VAR",
"fieldValue": "",
"blockType": "variables_set"
}
]
}
]
}

0 comments on commit 00ca673

Please sign in to comment.