Q: Display class high-score on individual user's screen?

Dear Desmos CL folks,

I’ve made a rudimentary angle-degree learning game as a type of space invaders. I’m also making a radians version (which is a lot harder to play, even though I thought I was familiar with radians!).

Kids like to compete and compare high-scores, so I have each individual user’s high score displayed on the screen. I would like also to display the class-wide high-score, and I strongly expect that Desmos CL can do that. However, I haven’t been able to figure out from the online documentation how to get the value of a specific variable across the current activity-status of an enrolled class of students.

Any help greatly appreciated!
Many thanks,

Raj

1 Like

I believe the solution is through the aggregate function… Set up a number list (with the number of students) in the graph populated by zeros.

L=[0]
S=L.random(20)

Then find the maximum value of the list by, say M=max(S)

Then, use the aggregate function in the CL of the graph to aggregate your variable h_{ighscore}, creating a number list to overwrite the list S in the graph.

The only thing i am not sure about is whether it’s possible to simultaneously use the graph as a source and as a sink.

Look at the examples in the CL documentation on how aggregate works,
https://teacher.desmos.com/computation-layer/documentation#aggregate

One more thing that I am not sure about… whether the aggregate function operates on variables that are not some sort of direct student input.

1 Like

Thanks! I’ll try this and will let you know how it goes.

Thanks also for the warning about aggregate possibly not accepting all variable types. I’ll watch out for that. My guess is that it would be harder to make the function accept only some types of variables, so maybe the default would be that any variable will work? I’ll see!

Raj

1 Like

Quick update: I tried the aggregate function, as you suggested, and then gave it to a class of students. The class hi-score function works! Thanks so much.

The aggregate function seems to work ok with variables even if they are calculate, rather than being directly entered by the students.

Thanks again!

That is great!! Glad it works… i’ve only used aggregate with direct student input. Great to know it works with indirectly calculated variables as well.

1 Like

Thanks!

Here’s the degrees version:

and here’s the radians version:

2 Likes