# Need to make Action Button check for correct student response

Almost done with the above activity. I’d like to create an action button on slides 2, 4, and 6 that checks to make sure students have the points in the correct place. I’m struggling with getting this done, can anyone provide assistance?

Sidenote: I show the overlay and have a class discussion about everyone’s points after slides 2, 4, and 6. If there’s a way to turn it in to a point collector that would be awesome. If not, I understand.

1 Like

If you put a button on those screens you could have the note’s content depend on whether the button has been pressed or not.

e.g. If not pressed it tells them to drag the points. If it has been pressed the content of the note could say “All correct, proceed to the next screen” or “At least one of your points is in the wrong spot.”

There are a few steps involved in all of that but if you break the request into something smaller I’m sure someone can help you!

(Side note from me: I think it is also a good idea to use the correct sink on the graph screens so at least on your dashboard you could alert students to the errors.)

1 Like

Here’s one with as little code as possible (2 lines):

Uses conditional function I(x,y) in the graph to determine if the point satisfies the task and shows either the “Correct” point or “incorrect” point based on the results. The only line of code needed in the graph is to determine when the button is and is not pressed. Can be used alongside @Bryn’s suggestion and works together well!

2 Likes

I have a question for you Jay, I’m interested to know the meaning behind the elements in the conditional function I. On the desmos graph you have the following lines for example: “(x1y1{A=0})” “(x1y1{A=1}{I(x1y1)=0}” “A = 0” and "I(x, y) = {x + y > 5:1, 0}. I’m a little confused about what each of these inputs mean and what they’re in charge of doing.

`A` is a variable created in CL that determines if the button has been pressed or not. Any points with {A=0} as a condition will only show when the button has not been pressed (these are the draggable ones). Any points with {A=1} as a condition are for feedback and will only show after the button has been pressed

`I(x, y) = {x + y > 5:1, 0}` is a piecewise function that outputs a value of 1 if the sum of x and y is greater than 5 and 0 if it is not.

For the feedback points, I evaluate the function `I` at the current coordinates and show the corresponding point. a red “x” when it evaluates to 0 and a green “o” when it evaluates to 1.

With the advancements to the calculator over the last two years, this can now be done with much fewer lines. Maybe this is easier to understand:
https://www.desmos.com/calculator/1hjiyegiy5