Graphing lines immediate feedback and a final slide with a score

Here is an activity based on an assignment.

Right now I have it almost working exactly the way I want it to, but it is still saying a graph is correct if the slope is right OR if the y-intercept is right. So, it confuses students who have just one part right and it is telling them the whole thing is right. Not sure how to fix it.

Any help would be appreciated.

Allow me to add a clarification.

Everything works… EXCEPT… The graph will show that it is correct as long as one component is correct.

In your graph, you have I(x,y) = {m=3,b=0:1,0}. The comma makes this an “or” statement, so either being correct returns true. If you want to require both, you can use one as a restriction to the other I(x,y) = {m=3{b=0}:1,0}. Alternatively, you can use a number sink that uses your CL correctness to define it, instead of correcting in the graph. Is this what you mean?

That’s it!

I’m getting better with the CL terminology and can usually track that, but the specifics in the graphs feels almost foreign.


noteProblem(NOTE: CL CODE)

line = `y=1/2x-6`
m = xyLine(line).slope
b = xyLine(line).yIntercept

For Feedback (NOTE: CL CODE)
hidden: not(graph.script.correct)

graph(Graph: CL CODE)

xTransform = simpleFunction(`x`,`x`,`y`) # Change all x values to themselves (x)
yTransform = simpleFunction(`0`,`x`,`y`) # Change all y values to 0.
flatten = this.sketch.transform(xTransform,yTransform)

xMin = min(flatten.xValuesAt(0))
xMax = max(flatten.xValuesAt(0))

number(`x_{min}`): xMin
number(`x_{max}`): xMax

number(`y_{min}`): max(this.sketch.yValuesAt(xMin))
number(`y_{max}`): max(this.sketch.yValuesAt(xMax))

number(`m_{actual}`):noteProblem.script.m
number(`b_{actual}`):noteProblem.script.b

correct = this.number(`C`)=1
correct: correct

Try the above code. Hopefully it helps a little.

You’re using a bunch of code that works for sketches, but graphs don’t have the same sources. For example, .xValuesAt() is only for something sketched, and doesn’t work with values within a graph. Good thought though!