Merging button click count

Making an activity where student clicks on “Right Face” to make a -90 degree turn. “Left Face” to make a 90 degree turn.

Goal is to use the tool to confirm student hypothesis on some long chain command: RF, RF, RF, LF, LF = -90º final position.

I’ve used the modulus to break it down into eight possible position states. Next step seems to be creating a variable that subtracts “Left Face” click count from “Right Face” click count, winnowing it down to four position states.

Is this possible?

You could just use the pressCount for each.

RF=RFbutton.pressCount
LF=LFbutton.pressCount
final = numericValue("\mod(${RF}-${LF},4)")
1 Like

Thanks! I hacked it by pushing the values into the graphing calculator where I’m a little more comfortable.

The final line is helpful, though, as I’m forcing myself to get more comfortable with the CL code.

1 Like

It’s frequently more convenient to do calculations in a graph than in CL. Generating random numbers works more easily in CL than in graphs, but other than that…