pxt-arcade icon indicating copy to clipboard operation
pxt-arcade copied to clipboard

Check for required block/command

Open Vegz78 opened this issue 1 year ago • 4 comments

Is your feature request related to a problem? Please describe. In an educational setting or a tutorial, it would be useful to be able to check whether a required block or command is placed/present.

Describe the solution you'd like Either in the turorial scripting language, or some kind of meta programming functionality in STS being able to check for blocks or commands being used or present, e.g.:

  1. ’ ’ 'required agent.move(BACK,1) - 2 ’ ’ ’

  2. if exists(variable/function/block/command) then {}

Describe alternatives you've considered Searched the forum for workarounds/alternatives, no luck, asked to file a feature request here.

Additional context Further details: https://forum.makecode.com/t/new-tools-in-makecode-tutorial/22285

Vegz78 avatar Nov 08 '23 21:11 Vegz78

I think that a tool that allows you to impose the use of a specific block/blocks is a very necessary addition. In the example below, I am pasting a piece of code from a tutorial for children regarding loops. Unfortunately, without additional safeguards, which are time-consuming and not always possible, children can complete this task without using loops. Which makes the classes a waste of time because the child will do what he already knows. image

Lukaszzaraska avatar Nov 08 '23 23:11 Lukaszzaraska

There are alternatives for some cases. The problem with loops that I wrote about above can be solved by using command blocks and measuring the time in which the agent completes the route. If it exceeds the time limit because, for example, the child did everything manually, the level will be reset. The second way I was thinking about is to create your own blocks that work in the same way as the basic ones, e.g. agent move forward, but in addition to executing this command, they increase the value of the variable, which allows us to count how many times the child used this block. But it requires a lot of work for each task created.

Lukaszzaraska avatar Nov 08 '23 23:11 Lukaszzaraska

So, we do have the ability to validate whether or not students used a block, but we don't have the ability to lock them out to the screen...

https://makecode.com/writing-docs/tutorials/basics#code-validation-validation-local-and-validation-global-sections-

kiki-lee avatar Nov 09 '23 18:11 kiki-lee

Does @kiki-lee's code validation suggestion solve your case/issue with e.g. the loop example, @Lukaszzaraska?

Vegz78 avatar Feb 13 '24 21:02 Vegz78