$\text{Check}$

$\text{NEW PROBLEM}$

Fix position and allow selection for all text objects

Empty all input boxes

$b=$

Reset app

\text{This is the error specific hint}

\text{Drag to start}

$\text\black{1}$

$\text\black{0}$

$a=\vphantom{b}$

\text{Describe the applet here}

$\text{Some string input}$

\text{Simplify your answer}

$\text\black{0}$

countQuestion = 0
allCaseNum = Shuffle({1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12})
caseNum = Element(allCaseNum, Mod[countQuestion, Length[allCaseNum]] + 1)
allConvFact: {1.6, 1609, 1094, 1.09, 3.3, 39, 91.4, 914, 30.5, 304.8, 2.54, 25.4}
convFact = Element(allConvFact, caseNum)
allCoeff = Shuffle({2, 3, 4, 5, 6, 7, 8, 9, 10})
coeff = Element(allCoeff, Mod[countQuestion, Length[allCoeff]] + 1)
textUnit1: "" + (LaTeX[If[caseNum ≤ 2, "mile", caseNum ≟ 3, "kilometer", 4 ≤ caseNum ≤ 6, "meter", 7 ≤ caseNum ≤ 8, "yard", 9 ≤ caseNum ≤ 10, "foot", "inch"]]) + ""
textUnit2: "\text{" + (LaTeX[If[caseNum ≟ 1, "kilometers", caseNum ≟ 2, "meters", 3 ≤ caseNum ≤ 4, "yards", caseNum ≟ 5, "feet", caseNum ≟ 6, "inches", caseNum ≟ 7 ∨ caseNum ≟ 9 ∨ caseNum ≟ 11, "centimeters", "millimeters"]]) + "}"
textUnit1Plural: "" + (LaTeX[If[caseNum ≤ 2, "miles", caseNum ≟ 3, "kilometers", 4 ≤ caseNum ≤ 6, "meters", 7 ≤ caseNum ≤ 8, "yards", 9 ≤ caseNum ≤ 10, "feet", "inches"]]) + ""
textQuestion: "\text{1 " + (LaTeX[textUnit1]) + " is about " + (LaTeX[convFact]) + " " + (LaTeX[textUnit2]) + ".\\
Estimate the number of " + (LaTeX[textUnit2]) + " in " + (LaTeX[coeff]) + " " + (LaTeX[textUnit1Plural]) + ".}"
allRandomSeeds = RandomUniform(0, 0.99, 200)
inputSaved: {""}
inputDefined: Sum[Zip[A ≠ "?" ∧ ReplaceAll[A, " ", ""] ≠ "", A, {stringA}]] ≟ 1
validA = true
validB = true
validC = true
inputCurrent: {stringA}
inputValid: Sum[{validA}] ≟ 1
inputA = NaN
inputB = NaN
numRandoms: 2
randIndex: (Mod[countQuestion, floor(Length[allRandomSeeds] / numRandoms)] * numRandoms) + 1
currentRandomSeeds = Take(allRandomSeeds, randIndex, randIndex + numRandoms - 1)
randomNum1: 1 + floor((currentRandomSeeds(1) * 20))
randomNum2: randomNum1 + 2 + floor((currentRandomSeeds(2) * 10))
validate = false
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
allRoundedForSol: {1.5, 1500, 1100, 1, 3.5, 40, 90, 900, 30, 300, 2.5, 25}
convFactSol = Element(allRoundedForSol, caseNum)
solVal: (coeff * convFactSol)
textSolution: "\text{\bold{Possible Solution}\\\\
Round 1 " + (LaTeX[textUnit1]) + " to " + (LaTeX[Element[allRoundedForSol, caseNum]]) + " " + (LaTeX[If[caseNum ≠ 4, textUnit2, "yard"]]) + ".\\
Multiply \[" + (LaTeX[coeff]) + "\times" + (LaTeX[Element[allRoundedForSol, caseNum]]) + "\approx " + (LaTeX[solVal]) + "\] " + (LaTeX[textUnit2]) + ".\\
There are about " + (LaTeX[solVal]) + " " + (LaTeX[textUnit2]) + " in " + (LaTeX[coeff]) + " " + (LaTeX[textUnit1Plural]) + ".
}"
InputBoxB = Textfield(inputB)
exactVal: (coeff * convFact)
noOp: Sum[RemoveUndefined[Zip[IndexOf[tt, stringA], tt, {"+", "-", "*", "/", "^", "(", ")"}]]] ≟ 0
exactCase: false
allConvFactDown: {1.5, 1500, 1000, 1, 3, 30, 90, 900, 25, 300, 2.5, 25}
allConvFactUp: {2, 2000, 1100, 1.1, 3.5, 50, 100, 1000, 50, 305, 3, 30}
convFactDown = Element(allConvFactDown, caseNum)
convFactUp = Element(allConvFactUp, caseNum)
accValDown: (coeff * convFactDown)
accValUp: (coeff * convFactUp)
correctApprox: accValDown ≤ inputA ≤ accValUp
showSimplifyMsg: false
correct: correctApprox ∧ (¬showSimplifyMsg)
isTypicalError: inputB ≟ inputA + 1
showbuttons = true
showhinttypicalerror = false
textCountCorrect: "\text{Number correct: " + (LaTeX[countCorrect]) + " }"
helpTextHintCirca: "\text{Try rounding the number of\\" + (LaTeX[textUnit2]) + " in " + (LaTeX[If[caseNum ≤ 10, "a", "an"]]) + " " + (LaTeX[textUnit1]) + ".\\\\
Drag the point to explore.}"
helpTextHint: "\text{" + (LaTeX[helpTextHintCirca]) + "}"
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16
pixelsTop: 24
textHint: "\text{\color{#C75000}\bold{Hint}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\"]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + "}"
layoutY: 178
layoutX: 16
layoutAppSize = Corner(5)
enableBtnValidate: inputCurrent ≠ inputSaved ∧ inputDefined ∧ inputValid ∧ (¬showSimplifyMsg)
pulsing = 0.6 (slider from 0 to 1, step 0.1)
UE: (12, 2)
SS: (0, -4)
SE: UE + (6, -6)
DR = Point(Segment[SS, SE])
onboarding: showhint ∧ DR ≟ (12, -4)
onboardingCase: 1
onboardingX: 337
onboardingY: 150
OnboardingTextOffset = onboardingTextOffset(Corner[onboardingText, 1], Corner[onboardingText, 3], onboardingCase, Corner[1], Corner[3], Corner[5])
onboardingDisplayText: "" + (LaTeX[onboardingText]) + ""
solutionView: showanswer ∨ showsolution
InputBoxA = Textfield(inputA)
altFeedback: "\text{" + (LaTeX[If[correct, (("Your answer is correct. Total number correct: " * countCorrect) * ". "), ("Your answer is not correct. " * If[tries < 3, "Try again. ", "Maybe next time. "])]]) + "}" + (LaTeX[If[showsolution, ("\\" * textSolution), If[showhint ∨ showhinttypicalerror, textHint, ""]]]) + ""
InputBoxC = Textfield(inputC)
maxTries: 3
labelBtnValidate: "\text{CHECK (" + (LaTeX[maxTries - tries]) + ")}"
enableInput: tries < maxTries ∧ (¬(validate ∧ correct))
textFeedback: "\text{\vphantom{✕}" + (LaTeX[If[correct, "\textcolor{#006758}{✓ Correct}", (("\textcolor{#B00020}{✕ " * If[tries < 3, "Try again", "Maybe next time"]) * "}")]]) + "}"
textRawInput: "" + coeff + " " + textUnit1Plural + " = "
labelLength = Length(textRawInput)
xPixelsLabelShift: round((9.5 * labelLength), 0)
xPosUnit2: xPixelsLabelShift + (8 * 15)
labelInputA: "\text{" + (LaTeX[coeff]) + " " + (LaTeX[textUnit1Plural]) + " " + (LaTeX[If[exactCase, "=", "≈"]]) + " }"
A: (3.73447 - 2, -3.90298)
B = (20.904574091789332, 5.825250440392515)
correctExact: false
US: (0, 2)
unitSegm = Segment(US, UE)
textUnit1Abbr: "\text{" + (LaTeX[If[caseNum ≤ 2, "mi", caseNum ≟ 3, "km", 4 ≤ caseNum ≤ 6, "m", 7 ≤ caseNum ≤ 8, "yd", 9 ≤ caseNum ≤ 10, "ft", "in"]]) + "}"
studentSegm = Segment(SS, DR)
textUnit2Abbr: "\text{" + (LaTeX[If[caseNum ≟ 1, "km", caseNum ≟ 2, "m", 3 ≤ caseNum ≤ 4, "yd", caseNum ≟ 5, "ft", caseNum ≟ 6, "in", caseNum ≟ 7 ∨ caseNum ≟ 9 ∨ caseNum ≟ 11, "cm", "mm"]]) + "}"
unit1NumTicks = If(caseNum ≤ 2 ∨ 7 ≤ caseNum ≤ 10, 4, 10)
unit2NumTicks = If(caseNum ≤ 2 ∨ 7 ≤ caseNum ≤ 10, 10, 4)
unit1Ticks = Sequence(Segment[(t, y(US) - 0.15), (t, y(US) + 0.15)], t, x(US), x(UE), Distance[US, UE] / 4)
unit2Grid = Sequence((t, y(SS)), t, x(SS), x(DR), Distance[SS, SE] / 6)
lbl1Val: round(If[caseNum ≟ 1, 1.6 / 4, caseNum ≟ 2, 1609 / 4, caseNum ≟ 3, 1094 / 4, caseNum ≟ 4, 1.09 / 4, caseNum ≟ 5, 3.3 / 4, caseNum ≟ 6, 39 / 4, caseNum ≟ 7, 91.4 / 4, caseNum ≟ 8, 914 / 4, caseNum ≟ 9, 30.5 / 4, caseNum ≟ 10, 304.8 / 4, caseNum ≟ 11, 2.54 / 4, 25.4 / 4], 1)
lbl2Val: round(If[caseNum ≟ 1, 1.6 / 2, caseNum ≟ 2, 1609 / 2, caseNum ≟ 3, 1094 / 2, caseNum ≟ 4, 1.09 / 2, caseNum ≟ 5, 3.3 / 2, caseNum ≟ 6, 39 / 2, caseNum ≟ 7, 91.4 / 2, caseNum ≟ 8, 914 / 2, caseNum ≟ 9, 30.5 / 2, caseNum ≟ 10, 304.8 / 2, caseNum ≟ 11, 2.54 / 2, 25.4 / 2], 1)
lbl3Val: round(If[caseNum ≟ 1, (3 * 1.6 / 4), caseNum ≟ 2, (3 * 1609 / 4), caseNum ≟ 3, (3 * 1094 / 4), caseNum ≟ 4, (3 * 1.09 / 4), caseNum ≟ 5, (3 * 3.3 / 4), caseNum ≟ 6, (3 * 39 / 4), caseNum ≟ 7, (3 * 91.4 / 4), caseNum ≟ 8, (3 * 914 / 4), caseNum ≟ 9, (3 * 30.5 / 4), caseNum ≟ 10, (3 * 304.8 / 4), caseNum ≟ 11, (3 * 2.54 / 4), (3 * 25.4 / 4)], 2)
lbl4Val: allConvFact(caseNum)
lbl5Val: round(If[caseNum ≟ 1, (5 * 1.6 / 4), caseNum ≟ 2, (5 * 1609 / 4), caseNum ≟ 3, (5 * 1094 / 4), caseNum ≟ 4, (5 * 1.09 / 4), caseNum ≟ 5, (5 * 3.3 / 4), caseNum ≟ 6, (5 * 39 / 4), caseNum ≟ 7, (5 * 91.4 / 4), caseNum ≟ 8, (5 * 914 / 4), caseNum ≟ 9, (5 * 30.5 / 4), caseNum ≟ 10, (5 * 304.8 / 4), caseNum ≟ 11, (5 * 2.54 / 4), (5 * 25.4 / 4)], 2)
lbl6Val: round(If[caseNum ≟ 1, (6 * 1.6 / 4), caseNum ≟ 2, (6 * 1609 / 4), caseNum ≟ 3, (6 * 1094 / 4), caseNum ≟ 4, (6 * 1.09 / 4), caseNum ≟ 5, (6 * 3.3 / 4), caseNum ≟ 6, (6 * 39 / 4), caseNum ≟ 7, (6 * 91.4 / 4), caseNum ≟ 8, (6 * 914 / 4), caseNum ≟ 9, (6 * 30.5 / 4), caseNum ≟ 10, (6 * 304.8 / 4), caseNum ≟ 11, (6 * 2.54 / 4), (6 * 25.4 / 4)], 2)
allLabels: {0, lbl1Val, lbl2Val, lbl3Val, lbl4Val, lbl5Val, lbl6Val}
allLabelsInPlace = Zip(Text[("" * A), B, false, true, 0, 0], A, allLabels, B, unit2Grid + (0, -0.85))
unit2Ticks = Sequence(Segment[(t, y(SS) - 0.15), (t, y(SS) + 0.15)], t, x(SS), x(DR), Distance[SS, SE] / 6)
currentVal: ((1.5 * Element[allConvFact, caseNum]) * studentSegm / 18)
currentValRoun: round(currentVal, If[caseNum ≟ 1 ∨ caseNum ≟ 5 ∨ caseNum ≥ 11, 1, 0])
labelCurrentValRoun: "" + (LaTeX[currentValRoun]) + ""
pulsingObject = circlePixels(DR, 7 + (7 * pulsing), Corner[1], Corner[3], Corner[5])
pulsingSpeed = If(onboarding, 8, 0)
labelCurrentVal: "" + (LaTeX[Element[allConvFact, caseNum]]) + ""
tabOrder: {textQuestion, labelInputA, InputBoxA, textUnit2, textWarning, btnValidate, DR, textHint, textSolution, btnNew}
currentValue: NaN

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: expandSegment
expandSegment(A,B,pixelGap,Corner1,Corner3,Corner5)
Input: A, B, pixelGap, Corner1, Corner3, Corner5
Output: newPoly

distanceX: (pixelGap / x(Corner5) * (x(Corner3) - x(Corner1)))
distanceY: (pixelGap / y(Corner5) * (y(Corner3) - y(Corner1)))
pointGap: distanceX
xyScale: distanceY / distanceX
A: (0, 0)
vecAB: B - A
pVec: (20 * UnitVector[(((-y(vecAB))) / xyScale, (x(vecAB) * xyScale))])
pVecAngle = Angle(xAxis, Line[(0, 0), pVec])
realAngle = If(pVecAngle ≟ pi / 2 ∨ pVecAngle ≟ (3 * pi / 2), pVecAngle, atand(tan(pVecAngle) / xyScale))
curveFunction = CurveCartesian((pointGap * cos(u)), ((pointGap * xyScale) * sin(u)), u, 0, (2 * pi))
K: curveFunction(realAngle)
vSpace = Vector(K)
allPoints: {A + vSpace, A - vSpace, B - vSpace, B + vSpace}
newPoly = Polygon(allPoints)

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: 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: checkFormat
checkFormat(inputString)
Input: inputString
Output: formatOK

3 / 4

numberString: "" + (ReplaceAll[inputString, " ", ""]) + ""
numSlash: Length[Split[(("(" * numberString) * ")"), {"/"}]] - 1
noImpliedMultiply: Length[Split[(("A" * numberString) * "A"), {"0(", "1(", "2(", "3(", "4(", "5(", "6(", "7(", "8(", "9(", " 1", " 0", " .", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9", " ("}]] ≟ 1
noSubtract: Length[Split[(("A" * numberString) * "A"), {"0-", "1-", "2-", "3-", "4-", "5-", "6-", "7-", "8-", "9-", ")-", " ((-", " (-", " (((-"}]] ≟ 1
noBadChars: Length[Split[(("(" * numberString) * ")"), {"+", "*", ")("}]] ≟ 1
formatOK: noBadChars ∧ noImpliedMultiply ∧ (numSlash ≟ 0 ∨ numSlash ≟ 1 ∧ Length[Split[(("A" * numberString) * "A"), {"."}]] ≟ 1) ∧ noSubtract