Drag point to a line and check correct

I am working on a pictogram and have the basics set up. I would like to figure out how to check if the student has moved “x” number of points to a specific line.

Here you are. I cleaned up a lot. Any time you’re repeating a lot of code, you can probably use a list instead, so your pictogram images and grid lines I condensed into individual lines using lists. I used some rounding in the line locations so you don’t need to worry about students having them a little (or even a lot) off.

Thank you for cleaning up the code. I really want to learn how to do this.

When I test this, the images are not “clicking in place” and I don’t see how it can check for correct. For example, the students should have 2 images on the 0 frequency line and 5 images on the 1 frequency line, etc.

Another approach which may make this simpler is to have + and - buttons next to each number, and students click on them to increase or decrease the number of pictures in each row. Then you wouldn’t have to worry about dragging issues. If you want to see an example of that, let me know, and I will put it together.

1 Like

The way Daniel_G has set it up, the frequencies are contained in the F_req list so you can compare against that. For instance, you could set up a C_Freq list [2, 5, …] and test using something like {F_req = C_Freq : 1, 0} which will yield 1 if the two lists match, and 0 if they don’t.

Not sure what you mean by “clicking into place” as the original file you shared didn’t behave differently as far as I can tell.

Here’s one where the images snap to the lines (not the points), so it can be a little confusing if you want to go back to adjust it.

Thank you, everyone for your help. I have used the last example that Daniel provided which has the images snapping to the lines. I have added two lines to the coding for checking for correct (lines 16 and 17) and added to the CL: correct: this.number(C_{orrect})=1 However, when I test this, I do not get a correct check mark. I’m not sure what to do to fix this. I do not understand line 15 code. Thank you, again for ALL of your assistance!!!

The bulk of it is list comprehension.
The L_ine list is the location for each emoji. Line 15 is checking the number of times each value occurs in the list.

L_ine[L_ine=2] would scan through list L_ine for all values equivalent to 2, and creates a new list with only those values. .length takes the length of that list. This is done for each value of n, 0 to 4, so you end up with a list of frequencies.

C_orrect is a list and can’t equal 1. Try using:

C_{orrect}=total( {F_{req}-C_{Freq}=0:1,0} )

and C_{orrect}=5 in your CL.

I’m still having problems getting this to show as correct on the teacher dashboard. I would really like for them to drag icons but maybe I need to look at the + or - option instead.

I still am not getting a correct mark on the teacher dashboard. Not sure what I am doing wrong. I did change the CL and the code in the graph based on your suggestion. I’m sorry that I am being difficult.

No worries - it takes a long time to learn the ins and outs of this. Here is an activity with the clicking option: Pictogram example with click • Activity Builder by Desmos

1 Like

Can’t really tell only looking at the graph. The graph portion looks okay. Are there any other components that could be affecting your correctness? Can you share your activity?

Thank you for your help!!

It’s on slide 2

Yep. Any component that has the possibility of a correct sink needs it or “readOnly: true”. So, your table needs the latter.

Thank you for all of your help!!