\text{Drag to start}

#4D4D4D

$\text{Check}$

$\text{NEW PROBLEM}$

Fix position and allow selection for all text objects

\text{This is the answer.}

\text{\bold{Possible Solution}\
This is the solution}

Reset app

\text{This is the error specific hint}

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#C75000

#E07415

\text{This is the general hint}

#eeeeee

#2E006758

#2EB00020

+

-

+\textsf{ or } -

$\text{START}$

$\text{NEW GAME}$

$\text{RULES}$

\text{
Move the target to the solution on\
the number line.\Find the answer as fast as you can!\You get more points if you answer\in less than 5 seconds.\
\\begin{array}{rl}
Correct &4 points\
Hit Target &2 points\
Under 5 Seconds &+2 points\
Under 10 Seconds&+1 point\
\end{array}
}

$\text{BACK}$

10

+

-

+\textsf{ or } -

$\text{START}$

allRandomSeeds = RandomUniform(0, 0.99, 200)
countQuestion = 0
xMin: -6.5
xMax: 106.5
targetSize: (xMax - xMin) / 55
circleSizes = Sequence(targetSize + ((targetSize * n) * 4 / 9), n, 0, 3)
numRandoms: 5
randIndex: (Mod[countQuestion, floor(Length[allRandomSeeds] / numRandoms)] * numRandoms) + 1
currentRandomSeeds = Take(allRandomSeeds, randIndex, randIndex + numRandoms - 1)
randMaxOnes: 1 + floor((currentRandomSeeds(2) * 9))
randMaxTens: 5 + floor((currentRandomSeeds(3) * 5))
randSubOnesStart: 1 + floor((currentRandomSeeds(1) * 9))
randSubOnes = If(randSubOnesStart ≠ randMaxOnes, randSubOnesStart, randSubOnesStart < 9, randSubOnesStart + 1, randSubOnesStart - 1)
randSubTens: 1 + floor((currentRandomSeeds(2) * 9))
randNums: {(randMaxTens * 10) + randMaxOnes, (randSubTens * 10) + randSubOnes}
randMax = Max(randNums)
typeChoice = 2 (slider from 0 to 3, step 1)
yMax: 54
yMin: yMax - ((xMax - xMin) * 5 / 8)
StartLine = PixelsToPoint((xMin, yMin), (xMax, yMax), (800, 500), (16, 380))
EndLine = PixelsToPoint((xMin, yMin), (xMax, yMax), (800, 500), (784, 380))
numberLinePoints = Sequence(StartLine + ((A * (x(EndLine) - x(StartLine)) / 12), 0), A, 1, 11)
dragPoints = Sequence(StartLine + ((A * (x(EndLine) - x(StartLine)) / 120), 0), A, 10, 110)
inputPoint = Point(dragPoints)
studentGuess: IndexOf[inputPoint, dragPoints] - 1
correctError: abs(randMax - studentGuess) ≤ circleSizes(4)
correct: studentGuess ≟ randMax
yBoxDialog = If(typeChoice ≟ 3, 9.9, typeChoice ≟ 2, 17.3, 24.7)
screenWidth: xMax - xMin
yPointDialog: yMax - PixelsToDistance[48, (xMin, yMin), (xMax, yMax), (800, 500)]
xPointDialog: xMin + screenWidth / 2 - 45 / 2
inputPixels = PointToPixels((xMin, yMin), (xMax, yMax), (800, 500), inputPoint)
PointDialog: (xPointDialog, yPointDialog)
PointDialogPixels = PointToPixels((xMin, yMin), (xMax, yMax), (800, 500), PointDialog)
animationSlider = 0 (slider from 0 to 1, step 0.01)
animationSlider2: animationSlider
angleDart = If(animationSlider2 ≤ 0.5 ∨ correct ∨ correctError, 0, pi / 6)
easeY(x) = If[x < 0.5, (-100 / 2 * ((2 * x))^(5)) + 50, correct ∨ correctError, 0, (100 / 2 * ((2 * x) - 2)^(5)) + 50]
ballY: easeY(animationSlider2)
easeX(x) = If[x ≤ 0.5 ∨ correct ∨ correctError, 0, (500 * (x - 0.5))]
correctX: x(dragPoints(randMax + 1))
ballX: easeX(animationSlider2) + correctX
ballBounce: (ballX, ballY)
onboarding = false
inputSaved: {(-20, -20)}
inputCurrent: {inputPoint}
pixelsTop: 24
pixelsBottom: 16
pixelsLeft: 16
pixelsRight: 16
validate = false
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
showbuttons = true
showhinttypicalerror = false
labelBtnValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
layoutY: 200
layoutX: 16
textHint: "\text{\color{" + (LaTeX[colorOrange]) + "}\bold{Hint}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\"]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + "}"
enableBtnValidate: inputCurrent ≠ inputSaved ∧ (¬onboarding)
pulsingSpeed: 8
pulsing = 0.2 (slider from 0 to 1, step 0.1)
onboardingCase: 4
OnboardingTextOffset = onboardingTextOffset(Corner[onboardingText, 1], Corner[onboardingText, 3], onboardingCase, Corner[1], Corner[3], Corner[5])
onboardingX: x(inputPixels) - 12
onboardingY: y(inputPixels) - 38
onboardingDisplayText: "" + (LaTeX[onboardingText]) + ""
randNum1: 5 + floor((currentRandomSeeds(4) * 5))
targetCircle1 = Circle(inputPoint, circleSizes(1))
targetCircle2 = Circle(inputPoint, circleSizes(2))
targetCircle3 = Circle(inputPoint, circleSizes(3))
targetCircle4 = Circle(inputPoint, circleSizes(4))
pulsingObject = circlePixels(inputPoint, 9 + (9 * pulsing), Corner[1], Corner[3], Corner[5])
textCountCorrect: "\text{Points: " + (LaTeX[countCorrect]) + " }"
timer = 0 (slider from 0 to 100, step 0.01)
randType: 1 + floor((currentRandomSeeds(1) * 2))
type = If(typeChoice > 1, 4 - typeChoice, randType)
randNum2 = If(type ≟ 1, randMax - randNum1, randMax + randNum1)
timeVal = 4.99
animationSpeed = If(correct ∨ correctError, 4, 2)
pointsAdded = 4
pointMoved = false
xLine: x(PointDialogPixels) + 81
yLine: y(PointDialogPixels) + 192
dialogBox = makeBox(PointDialog, 45, 45)
PointDialogPixels2 = PointToPixels(Corner[1], Corner[3], Corner[5], PointDialog + (45, -45))
dialogueBoxWidth: (x(PointDialogPixels2) - x(PointDialogPixels)) / 2
dialogButtonStart: dialogueBoxWidth - (123 + 51 + 8) / 2
dialogBorder: dialogBox
showDialog = true
showRules = false
textQuestion: "\text{" + (LaTeX[If[showRules, textInstructions, "Choose an operation."]]) + "}"
dimensions: {xMin, yMin, xMax, yMax}
textProb: "" + (LaTeX[randNum2]) + "" + (LaTeX[If[type ≟ 1, "+", "-"]]) + "" + (LaTeX[randNum1]) + ""
PointStart = (24.966437285735083, 31.954712951633127)
probDims: {abs(x(Corner[textProb, 1]) - x(Corner[textProb, 3])), abs(y(Corner[textProb, 1]) - y(Corner[textProb, 3]))}
probPix = Zip(DistanceToPixels[(xMin, yMin), (xMax, yMax), (800, 500), n], n, probDims)
textProbDisplay: "" + (LaTeX[textProb]) + ""
textFeedback: "" + (LaTeX[If[correct, "\text{✓ Correct}", correctError, "\text{‼ Almost}", "\text{✕  Try again}"]]) + ""
textPoints: "\begin{array}{c}" + (LaTeX[textFeedback]) + "\\\\
+" + (LaTeX[pointsAdded]) + "
\end{array}"
PointPoints: inputPoint + (If[x(inputPoint) > 5, -11, -5 - x(inputPoint)], 20)
PointTimer: (xMax, yMax) - (8, 8)
circleTimer = Circle(PointTimer, 5.5)
PointTimerTop: PointTimer + (0, 5.5)
timerAngle = If(timer ≤ 10, ((-2 * pi) * If[Mod[animationSlider, 1] ≟ 0, timer / 10, timeVal / 10]), (-2 * pi))
PointTimerTop' = Rotate(PointTimerTop, timerAngle, PointTimer)
timerShade = CircleSector(PointTimer, PointTimerTop', PointTimerTop)
enableInput: Mod[animationSlider, 1] ≟ 0 ∧ (¬showDialog)
timeBonus = If(timeVal < 5, 2, timeVal < 10, 1, 0)
boxSelect = makeBox((xPointDialog + 11, yPointDialog - yBoxDialog), 23, 5)
times: {}
accuracies: {}
accuracy: abs(x(inputPoint) - randMax)
timerSpeed: 1 / 10
aveTime: round(mean[times], 1)
aveAcc: round(mean[accuracies], 1)
textScore: "\textsf{Average }" + (LaTeX[aveAcc]) + "\textsf{ away from the target in }" + (LaTeX[aveTime]) + "\textsf{ seconds.}"
timeScores: {}
accuracyScores: {}
topAccuracy = Min(accuracyScores)
topTime = Min(timeScores)
textScores: "\textsf{Top Accuracy: }" + (LaTeX[topAccuracy]) + "\\\\\textsf{Top Speed: }" + (LaTeX[topTime]) + "\textsf{ seconds}"
DartStart: (21.71881, 1.29593)
DartLeft: DartStart - (20, 0)
picDartTrans = Translate(picDartStart, Vector[Midpoint[DartStart, DartLeft], ballBounce])
picDart = Rotate(picDartTrans, (-angleDart), ballBounce)
yBoxStarts: {9.9, 17.3, 24.7}
box1 = makeBox((xPointDialog + 11, yPointDialog - yBoxStarts(1)), 23, 5)
box2 = makeBox((xPointDialog + 11, yPointDialog - yBoxStarts(2)), 23, 5)
box3 = makeBox((xPointDialog + 11, yPointDialog - yBoxStarts(3)), 23, 5)
l1: {Corner[textPlus, 2] - Corner[textPlus, 4], Corner[textPlus, 4] - PointStart}
l2: {Corner[textMinus, 2] - Corner[textMinus, 4], Corner[textMinus, 4] - PointStart}
l3: {Corner[textBoth, 2] - Corner[textBoth, 4], Corner[textBoth, 4] - PointStart}
btnStartInactive: btnStart
DartTop: DartStart + (0, 15)
randomCorrect: 1 + floor((currentRandomSeeds(6) * 6))
BottomCorner: (xMax, yMin)
StartBoth: (xPointDialog + 11, yPointDialog - yBoxStarts(3)) + (23 / 2, -5 / 2) - (0.5 * l3(1)) - l3(2)
StartMinus: (xPointDialog + 11, yPointDialog - yBoxStarts(2)) + (23 / 2, -5 / 2) - (0.5 * l2(1)) - l2(2)
StartPlus: (xPointDialog + 11, yPointDialog - yBoxStarts(1)) + (23 / 2, -5 / 2) - (0.5 * l1(1)) - l1(2)
layoutAppSize: (800, 500)
numberLine = Segment(StartLine, EndLine)
textNums = Zip(Text[("" * A), B, true, true, 0, -1], A, Sequence[0, 100, 10], B, numberLinePoints)
isTypicalError: false
textSegs = Zip(Segment[A, A - (0, 0.5)], A, numberLinePoints)

Tool: PixelsToPoint
PixelsToPoint(Corner1,Corner3,Corner5,PixelCoords)
Input: Corner1, Corner3, Corner5, InputPixels
Output: OutputPoint

InputPixels: (100, 200)
xRight: x(Corner3)
xLeft: x(Corner1)
yTop: y(Corner3)
yBottom: y(Corner1)
yCoord: yTop - (y(InputPixels) / y(Corner5) * (yTop - yBottom))
xCoord: (x(InputPixels) / x(Corner5) * (xRight - xLeft)) + xLeft
OutputPoint: (xCoord, yCoord)

Tool: circlePixels
circlePixels(A,pixelRadius,Corner1,Corner3,Corner5
Input: A, pixelRadius, Corner1, Corner3, Corner5
Output: newCircle

pointRadius: (pixelRadius / x(Corner5) * (x(Corner3) - x(Corner1)))
newCircle = Circle(A, pointRadius)

Tool: onboardingTextOffset
onboardingTextOffset(textCorner1,textCorner3,case,corner1,corner3,corner5)
Input: CornerText1, CornerText3, case, Corner1, Corner3, Corner5
Output: TextOffset

xPixels: ((x(CornerText3) - x(CornerText1)) * x(Corner5) / (x(Corner3) - x(Corner1)))
yPixels: ((y(CornerText3) - y(CornerText1)) * y(Corner5) / (y(Corner3) - y(Corner1)))
xOffset = Element({27, (-xPixels) + 2, 16 - xPixels / 2, 16 - xPixels / 2}, case)
yOffset = Element({-23, -23, yPixels - 27, -49}, case)
TextOffset: (xOffset, yOffset)

Tool: makeBox
makeBox(point, width,height)
Input: PointText1, boxWidth, boxHeight
Output: BoxText1

PointText2: PointText1 + (boxWidth, 0)
PointText3: PointText2 - (0, boxHeight)
PointText4: PointText1 - (0, boxHeight)
BoxText1 = Polygon({PointText1, PointText2, PointText3, PointText4})

Tool: PointToPixels
PointToPixels(Corner1,Corner3,Corner5,InputPoint)
Input: Corner1, Corner3, Corner5, InputPoint
Output: OutputPixels

Corner1: (-5, -5)
Corner3: (16, 6)
Corner5: (300, 200)
xLeft: x(Corner1)
xRight: x(Corner3)
yTop: y(Corner3)
yBottom: y(Corner1)
yPixels: (y(Corner5) * (yTop - y(InputPoint)) / (yTop - yBottom))
xPixels: (x(Corner5) * (x(InputPoint) - xLeft) / (xRight - xLeft))
OutputPixels: (xPixels, yPixels)

Tool: PixelsToDistance
PixelsToDistance[ <Number>, <Point>, <Point>, <Point> ]
Input: InputPixels, Corner1, Corner3, Corner5
Output: OutputDistance

InputPixels: 5
xLeft: x(Corner1)
xRight: x(Corner3)
OutputDistance: (InputPixels / x(Corner5) * (xRight - xLeft))

Tool: DistanceToPixels
DistanceToPixels[ <Number>, <Point>, <Point>, <Point> ]
Input: Corner1, Corner3, Corner5, InputPixels
Output: OutputDistance

xLeft: x(Corner1)
xRight: x(Corner3)
OutputDistance: (InputPixels / (xRight - xLeft) * x(Corner5))