A goal in Tychos is a short piece of code in a scenario which can check a student's work. Goals are written by the scenario's author, usually an instructor. To the student, the goals appear as a sentence describing something the student should do. The goal will start out black when the student clicks Run. At a time defined within the goal, the goal is "checked" and if the goal is satisfied, it turns green. Otherwise it turns red.
See an example:
A goal has three parts: (1) a description which the student sees, (2) a when condition which specifies at what time the goal will be checked, and (3) the victory condition which specifies what value the student is supposed to create. Here is a simple goal:
Goal 1 - description: Create a variable 'b' and set it to 3. - when:
t == 0 - victory:
b == 3
The above goal's when condition, when
t is 0, causes the victory condition will be checked right after the initial state code is run, and before the first calculations code is run. To satisfy this goal, the student can write this:
# Intial Stateb = 3
Note that if the student writes
b=3 in the calculations editor, the goal will not be satisfied because no calculations are run yet at
Here is another goal that will check that a student can increment a value in the calculations editor:
Goal 2 - description: Increment 'b' by 2 every frame - when:
frame_count == 10 - victory:
b == 23
With these two goals, you are checking that the student has properly set the initial condition, and that every frame,
b's value is incrementing by two.
In order to write a goal, you need to be logged in as an Instructor. Only instructors see blue edit buttons over the goals. See illustration.
When you click the pencil button to edit a goal, the goal turns into three edit boxes that contain the description, when the goal should be checked, and the victory condition. The description is for the student to read and must be specific enough for the student to understand what to do. The two conditions are bits of code that specify:
when condition: When the victory condition should be run, e.g. at t=0 or when a particle's X position = 10.
victory condtiion: What would indicate the student has accomplished the goal.
Descriptions are just English sentences that tell the student what your goal is going to check for. Descriptions are similar to quiz questions—they are easy to misinterpret. It's useful to have someone proof-read your descriptions to see if there are other interpretations of what you have written.
The When condition is needed to tell the goal when it should check the student's work. For example if you want the student to create a variable named
b and assign it the value
3, then you would might have the goal check at
frame_count == 0 which means right at the beginning.
But if you want to see if the student is changing a variable in the calculations editor, then you'll want to check in later frames since the frame 0 is just the initial state editor and later frames run the code in calculations.
Another variable you might check is
t which is how many seconds have elapsed in the simulation.
The Victory condition code will be checked when the when condition is satisfied. Generally the victory condtion code will check a variable which you have asked the student to set. It might be set directly such as "create a variabe
b and set it to
3", or might be indirect. For example if you want a student to write:
# Initial Statev = [5, 0]p = Particle([0,0])# Calculations:p.pos = p.pos + v * dt
Then here is a goal that checks the proper p.pos at 1 second:
Goal 3 - description: Make a particle
p start at X=0 and move to the right 5 units per second. - when condition:
t == 1 - victory condition:
Goal 3 checked only the X position of the particle. If you want to check both X and Y, or if you have a bigger matrix, you don't want to check each element individually. You might think comparing two matrices is what you want, e.g.
p.pos == [10,20]. Try typing this into the calculations editor to see what happens: it returns
[true, true] — it's comparing each element of those two matrices. That won't work for a goal.
Instead you need the MathNotepad function
deepEqual like so:
deepEqual(p.pos, [10, 20]) which returns either
Goal 4 - description: Create a force vector 'f' and set it to a horizontal value of 0, and a vertical value of 50. - when condition:
t == 0 - victory condition:
deepEqual(v, [0, 50])
For a goal to check the distance between two points, use the MathNotepad function
Goal 5 - description: Adjust when the force 'f' starts so that particle 'p' moves within 25 meters of the goal [50, 500] at 10 seconds. - when condition:
t == 10 - victory condition:
distance(p.pos, [50, 500]) < 25