# To collapse, lock, or expand functions in CoBlocks

In 2018 I used little CoSpaces. My students coded mostly with Microsoft MakeCode for BBC micro:bit (very good) or TinkerCAD Circuits.
I mostly used CoSpaces to simulate the behavior of systems by giving my students links to spaces I made with Blockly. My students were playing the simulations without being able to see the code. With the automatic conversion into CoBlocks, I now have a lot of work for my codes to work again (because I often used JavaScript in blocks).

Since a few weeks I design new spaces with CoBlocks to allow my students to code with CoBlocks. Unfortunately I don’t know how to deal with the work I ask my students.

In a general way, I wish that my students analyze progressively a modeling that I give, by completing or modifying some lines with CoBlocks.
I am currently working on the simulation of the kinematics of an Ariane 5 launch in order to compare the numerical results with the data of a real launch. The code is currently 227 lines including 200 lines to define functions.
Suppose that in my code there are 3 functions F1 to F3 and that I wish that my pupils work on the functions F1 and F2 by completing a few lines in each of these functions.
I wish to be able to give these different scenes to my students (in their CoSpaces account):

• Scene 1 = F1 to complete + F3 (collapsed and expandable)
• Scene 1 completed = F1 completed (collapsed and locked) + F3 (collapsed and expandable)
• Scene 2 = F1 completed (collapsed and locked) + F2 to complete + F3 (collapsed and expandable)
• Scene 2 completed = F1 completed (collapsed and locked) + F2 completed (collapsed and locked) + F3 (collapsed and expandable)

My needs :

1. To choose the order of functions in the program by putting F1 before F3 (impossible to posteriori?).
2. To collapse the functions on which students don’t work, like F3, with the possibility to expand them for curious students.
3. To lock some functions collapsed by the teacher, as a function completed by the teacher, to prevent students from seeing the code corrected, but also to limit possible errors.
Completed Scene 1 allows students to better understand what is being asked by playing the stage.
Scene 2 allows the student to work on F2 even if he did not succeed the job requested on F1.

I am blocked because I do not know how to do for the work that I wish to give Monday to my pupils.