Introduce an InitialCondition class which is essentially a placeholder for a value that can be used in annotations but which isn’t set until the student’s submission is executed. you would write annotations like this:
ic = pybryt.InitialCondition(name="foo")
pybryt.Value(2 + ic)
pybryt.Value(2 * ic)
pybryt.Value(ic.apply(lambda v: v ** 0.5))
The InitialCondition class can be transformed as needed with arithmetic operators and functions but all results would be derived from the same root value. Then, in the student’s submission, there would be a block like
pybryt.set_initial_conditions({
"foo": foo, # key matches the 'name' of the InitialCondition
"bar": bar,
})
that records the values of the initial conditions in the memory footprint so that they can be used to check the annotations.
Introduce an
InitialCondition
class which is essentially a placeholder for a value that can be used in annotations but which isn’t set until the student’s submission is executed. you would write annotations like this:The
InitialCondition
class can be transformed as needed with arithmetic operators and functions but all results would be derived from the same root value. Then, in the student’s submission, there would be a block likethat records the values of the initial conditions in the memory footprint so that they can be used to check the annotations.