frame_count == 0
"deepEqual(puck.pos, [0, 0])
"frame_count
is 0, which causes the victory condition to 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:frame_count
variable allows you to track the frame of the simulation.deepEqual
to see if the position of the puck particle is [0, 0]
. When comparing matrices for equivalency, you need to use deepEqual
.t == 2
"deepEqual(puck.pos, [10, 10])
"t
is 2, which causes the victory condition to be checked at the moment the simulation reaches a time of 2 seconds. This example demonstrates that you can choose either to trigger the Goal test using a specific frame, or a time in seconds.t == 2
"distance(frame(0).puck.pos, puck.pos) == 10
"and
and or
to combine conditions. This can be helpful in making sure that something is meeting two different conditions, or could be meeting one of two (or three, etc.)between
function is useful to see if a variable value is in a range. It makes writing some victory conditions a bit easier.