\hspace{51px}

\hspace{50px}

How tall do you need to be to ride a roller coaster?

How many points are needed to win the prize?

How much does the souvenir cost?

Element(randomCase, Mod(countQuestion, Length(randomCase)) + 1)

location of all the frame positions for each of the 4 cases.

#3A6ED6

#DA2570

#006758

#252525

#C75000

#4D4D4D

$\text{Check}$

$\text{NEW PROBLEM}$

Fix position and allow selection for all text objects

Empty all input boxes

Reset app

#B00020

#757575

#949494

#E44461

#E66B9E

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#E07415

#eeeeee

#2E006758

#2EB00020

set in btnNew and btnCalculate.

box2

\text{Drag into the blanks}

\text{Select a question}

randomNames = Shuffle({"Anara", "Leandro", "Viktoria", "Mari", "Elias", "Domenic"})
randomXVals = Shuffle(Sequence[42, 55])
possibleOrdersA = Shuffle({{1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2}, {3, 2, 1}})
randomCase = Shuffle(Sequence[1, 4])
randomYVals = Shuffle({46, 48, 50, 52, 54, 56})
countQuestion = 0
name: "" + (LaTeX[Element[randomNames, Mod[countQuestion, Length[randomNames]] + 1]]) + ""
movingIndex = NaN
P3 = (63.18475847350757, 8.025204333564375)
P2 = (43.68475847350757, 8.025204333564375)
P1 = (24.18475847350757, 8.025204333564375)
movingPoints: {P1, P2, P3}
PMove = Element(movingPoints, movingIndex)
valY = Element(randomYVals, Mod[countQuestion, Length[randomYVals]] + 1)
validX = RemoveUndefined(Zip[If[A < valY, A], A, randomXVals])
valX = Element(validX, Mod[countQuestion, Length[validX]] + 1)
valDiff: valY - valX
homeIndices = Element(possibleOrdersA, Mod[countQuestion, Length[possibleOrdersA]] + 1)
textStrCurrent = Zip(Element[{("" * valX), ("" * valY), ("" * valDiff)}, A], A, homeIndices)
boxText = Zip(Text[("" * A), B, true, true, 0, 0], A, textStrCurrent, B, movingPoints)
currentLocations: {-1, -1, -1}
caseNum = Element(randomCase, Mod[countQuestion, Length[randomCase]] + 1)
expectedAns = Element({{1, 2}, {2, 1}, {1, 2}, {2, 1}}, caseNum)
order = Element(possibleOrdersA, Mod[countQuestion, Length[possibleOrdersA]] + 1)
studentAns = Zip(homeIndices(IndexOf[A, currentLocations]), A, {1, 2})
questionA1: "How many inches does " + name + " need to grow in order to ride the roller coaster?"
questionA2: (("How tall is " * name) * "?")
questionB2: (("How long has " * name) * " been waiting?")
questionB1: "How many more minutes should " + name + " be expecting to wait in line?"
questionB3: (("How long does " * name) * " have to wait in total?")
questionC1: "How many more points does " + name + " need to win the prize?"
questionC2: (("How many points does " * name) * " have already?")
questionD1: (("How much more money does " * name) * " need to purchase the souvenir?")
questionD2: (("How much money does " * name) * " have now?")
currentQuestions = Element({{questionA1, questionA2, questionA3}, {questionB1, questionB2, questionB3}, {questionC1, questionC2, questionC3}, {questionD1, questionD2, questionD3}}, caseNum)
selectQuestion = Append("$\text\phantom{this is an empty line}$", Zip[(("$\text{" * currentQuestions(A)) * " }$"), A, order])
selectedQuestion = If(SelectedIndex[selectQuestion] ≠ 1, order(SelectedIndex[selectQuestion] - 1), NaN)
nameWidth: x(Corner[name, 3]) - x(Corner[name, 1])
positions: {{(28, -8) + (nameWidth, 0), (73.7, -23.5)}, {(204, -8), (79, -24) + (nameWidth, 0)}, {(52, -8) + (nameWidth, 0), (82, -25.2)}, {(163, -8), (48, -25) + (nameWidth, 0)}}
ineqLine1: "" + (LaTeX[Element[{((("" * valX) * "\plus h&\ge") * valY), ((("h\plus" * valX) * "&\ge") * valY), ((("" * valY) * "-h&\le") * valX), (((("" * valX) * "&\ge") * valY) * "-h"), (((("" * valY) * "&\le") * valX) * "+h"), ((("" * valY) * "&\le h\plus") * valX)}, caseNum]]) + ""
boxWidth: 13
boxHeight: boxWidth
boxAnchors = Element(positions, caseNum)
power = If(caseNum < 5, "", "^2")
typicalErrorNumber = 1
inputCurrent = Append(studentAns, selectedQuestion)
highlightColor: colorTealSuccess
validate = false
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
correct: studentAns ≟ expectedAns ∧ selectedQuestion ≟ 1
showbuttons = true
helpTextHintTypicalError: "\textsf{Use the inequality to determine the correct numbers for the problem. The\\
answer to the final question is " + (LaTeX[valDiff]) + "."
showhinttypicalerror = false
textCountCorrect: "\text{Number correct: " + (LaTeX[countCorrect]) + " }"
labelBtnValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
helpTextHint: "\text{" + (LaTeX[""]) + "}"
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16
pixelsTop: 24
borderBox = Polygon(Zip[PixelsToPoint[Corner[1], Corner[3], Corner[5], A], A, {(pixelsLeft, pixelsTop), (pixelsLeft, y(Corner[5]) - pixelsBottom), Corner[5] - (pixelsRight, pixelsBottom), (x(Corner[5]) - pixelsRight, pixelsTop)}])
layoutY = 257
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
layoutX: 16
layoutAppSize = Corner(5)
inputSaved: {NaN, NaN, NaN}
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correct}$", "$\text{✕ " + (If[tries < 3, "Try again", "Maybe next time"]) + "}$"]]) + ""
organizing = false
HomeAnchor = (24.18475847350757, 8.025204333564375)
innerSize: 13
box1 = centerBox(innerSize, innerSize, P1)
box2 = centerBox(innerSize, innerSize, P2)
box3 = centerBox(innerSize, innerSize, P3)
highlightBox = centerBox(innerSize, innerSize, PMove)
HOME: -1
allHome = Zip(HOME, A, movingPoints)
tmpIndex = NaN
textHighlight = Text(("" * boxText(movingIndex)), If[Defined[PMove], PMove, (300, 300)], false, true, 0, 0)
cmdFixBoxes = Sequence((("SetFixed(box" * A) * ",false,enableInput)"), A, 1, Length[movingPoints])
NOANSWER: -1
enableBtnValidate: inputCurrent ≠ inputSaved ∧ inputCurrent ≟ RemoveUndefined[inputCurrent]
cmdOrganize = Sequence((((((((("SetValue(P" * A) * ",If(currentLocations(") * A) * ")==HOME,homeLocations(") * A) * "),boxAnchors(currentLocations(") * A) * "))))"), A, 1, Length[movingPoints])
frame1 = centerBox(boxWidth, boxHeight, boxAnchors(1))
frame2 = centerBox(boxWidth, boxHeight, boxAnchors(2))
homeLocations = Sequence(HomeAnchor + (((A * 1.5) * boxWidth), 0), A, 0, Length[movingPoints] - 1)
isTypicalError: ¬correct
locationPMove = IndexOf(true, Zip[IsInRegion[PMove, A], A, {frame1, frame2}])
soln: "\begin{align}" + (LaTeX[ineqLine1]) + "\\h&\ge" + (LaTeX[valY]) + "-" + (LaTeX[valX]) + "\\h&\ge" + (LaTeX[valY - valX]) + "\end{align}"
minGrowth: valY - valX
ineqLatex: "" + (LaTeX[ReplaceAll[ineqLine1, "&", ""]]) + ""
questionB: "A theme park app says the average wait time for a ride is at least " + (LaTeX[space1]) + " minutes.\\\vspace{5mm}\\" + (LaTeX[name]) + " has been waiting for " + (LaTeX[space2]) + " minutes. "
questionC: "" + (LaTeX[name]) + " has earned " + (LaTeX[space1]) + " points in a carnival game. \\\vspace{5mm}\\Players need at least " + (LaTeX[space2]) + " points to win a prize toy. "
questionA: "" + (LaTeX[name]) + " is " + (LaTeX[space1]) + " inches tall. \\\vspace{5mm}\\Riders need to be " + (LaTeX[space2]) + " inches tall to ride a roller coaster."
questionD: "The most popular souvenir at a theme park costs \$" + (LaTeX[space1]) + ".\\\vspace{5mm}\\" + (LaTeX[name]) + " brought \$" + (LaTeX[space2]) + " in pocket money to a theme park."
line3Options = Element({{questionA1, questionA2, questionA3}, {questionB1, questionB2, questionB3}, {questionC1, questionC2, questionC3}, {questionD1, questionD2, questionD3}}, caseNum)
wordProblem: "\text{" + (LaTeX[Element[{questionA, questionB, questionC, questionD}, caseNum]]) + "}"
ansA: (((((("In order to ride the roller coaster, " * name) * " must grow at least ") * valDiff) * " inch") * If[valDiff ≟ 1, "", "es"]) * ".")
ansB: "" + name + " should expect to wait in line for at least " + (If[valDiff ≟ 1, "one more minute", (("" * valDiff) * " more minutes")]) + "."
ansC: "" + name + " needs " + valDiff + " more point" + (If[valDiff ≟ 1, "", "s"]) + " to win the prize."
ansD: "" + (LaTeX[name]) + " needs \$" + (LaTeX[valDiff]) + " more to purchase the souvenir."
hintSolution: "\hspace{50px}" + (LaTeX[soln]) + "\\
\textsf{" + (LaTeX[Element[{ansA, ansB, ansC, ansD}, caseNum]]) + "}"
test = SelectedIndex(selectQuestion)
highlightFrame = centerBox(boxWidth, boxWidth, boxAnchors(locationPMove))
textQuestion: "\textsf{Create a word problem for the inequality }" + (LaTeX[ineqLatex]) + "."
onboarding = true
pulsingSpeed: 8
pulsing = 0.5 (slider from 0 to 1, step 0.1)
onboardingX: 200
onboardingY = 89
onboardingCase: 1
OnboardingTextOffset = onboardingTextOffset(Corner[onboardingText, 1], Corner[onboardingText, 3], onboardingCase, Corner[1], Corner[3], Corner[5])
onboardingDisplayText: "" + (LaTeX[onboardingText]) + ""
pulsingObjects = Zip(expandQuad[Vertex[A, 1], Vertex[A, 2], Vertex[A, 3], Vertex[A, 4], (pulsing * 7), Corner[1], Corner[3], Corner[5]], A, {box1, box2, box3})
textHint: "\textsf{\color{" + (LaTeX[colorOrange]) + "}\bold{Hint}}\\" + (LaTeX[hintSolution]) + ""
onboarding2: countQuestion ≟ 0 ∧ (¬Defined[selectedQuestion])
textSolution_{1}: "\textsf\bold{Possible Solution}\\\\" + (LaTeX[ReplaceAll[ReplaceAll[ReplaceAll[wordProblem, space1, (("\\(" * Element[{valX, valY, valX, valY}, caseNum]) * "\\)")], space2, (("\\(" * Element[{valY, valX, valY, valX}, caseNum]) * "\\)")], "\vspace{5mm}", ""]]) + "\\
\textsf{" + (LaTeX[Element[{questionA1, questionB1, questionC1, questionD1}, caseNum]]) + "}"

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: PixelsToPoint (command PixelsToPoint1)
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: 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) * (y(InputPoint) - yBottom) / (yTop - yBottom))
xPixels: (x(Corner5) * (x(InputPoint) - xLeft) / (xRight - xLeft))
OutputPixels: (xPixels, yPixels)

Tool: centerBox
(width,height,CenterPoint)
Input: width, length, StartPoint
Output: myBox

StartPoint: (0, 0)
A: StartPoint + (((-width)) / 2, ((-length)) / 2)
D: A + (0, length)
B: A + (width, 0)
C: A + (width, length)
myBox = Polygon({A, B, C, D})

Tool: pixelsToDistanceX
pixelsToDistanceX(inputPixels,corner1,corner3,corner5)
Input: inputPixels, Corner1, Corner3, Corner5
Output: outputDistance

inputPixels: 5
Corner1: (-4, -2)
Corner3: (6, 6)
Corner5: (800, 500)
xLeft: x(Corner1)
xRight: x(Corner3)
outputDistance: (inputPixels / x(Corner5) * (xRight - xLeft))

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: expandQuad
expandQuad(A,B,C,D,pixelGap,Corner1,Corner3,Corner5)
Input: A, B, C, D, pixelGap, Corner1, Corner3, Corner5
Output: newPolygon

Corner5: (800, 500)
Corner3: (7, 6)
Corner1: (-4, -2)
distanceY: (pixelGap / y(Corner5) * (y(Corner3) - y(Corner1)))
distanceX: (pixelGap / x(Corner5) * (x(Corner3) - x(Corner1)))
pointGap: distanceX
allVerts: {A, B, C, D}
concaveAngles = Zip(Angle[I, J, K] > 180°, I, Append[allVerts(-1), allVerts], J, allVerts, K, Append[Take[allVerts, 2], allVerts(1)])
allVecs = Zip(Vector[J, K], J, allVerts, K, Append[Take[allVerts, 2], allVerts(1)])
pVecs = Zip(Vector[UnitOrthogonalVector[A]], Vector[A], allVecs)
xyScale: (distanceY) / (distanceX)
circTemplate = CurveCartesian((pointGap * cos(t)), ((xyScale * pointGap) * sin(t)), t, 0, (2 * pi))
scaledVecs = Zip(Vector[(x(K), (xyScale * y(K)))], Vector[K], pVecs)
vPointsPre = Zip(A - (pointGap * B), A, allVerts, B, Append[scaledVecs(-1), scaledVecs])
vPointsPost = Zip(A - (pointGap * B), A, allVerts, Vector[B], scaledVecs)
endAngles = Zip(Angle[M + (1, 0), M, K], K, vPointsPost, M, allVerts)
startAngles = Zip(Angle[M + (1, 0), M, K], K, vPointsPre, J, vPointsPost, M, allVerts)
roundedCornersConvex = Zip(Sequence[circTemplate(K) + A, K, B, C + If[B > C, (2 * pi), 0], (C + If[B > C, (2 * pi), 0] - B) / 4], A, allVerts, B, endAngles, C, startAngles)
roundedCornersConcave = Zip(Sequence[circTemplate(K) + A, K, B, C + If[B > C, (2 * pi), 0], (C + If[B > C, (2 * pi), 0] - B) / 4], A, allVerts, B, startAngles, C, endAngles)
cornerAngles = Zip(Angle[A, B, C], A, vPointsPre, B, allVerts, C, vPointsPost)
cornerPoints = Flatten(Zip[If[¬Concave, {Element[D, 3]}, If[A < pi / 3 ∨ (¬Concave), {Element[C, 3]}, C]], A, cornerAngles, C, roundedCornersConcave, D, roundedCornersConvex, Concave, concaveAngles])
newPolygon = Polygon(cornerPoints)