used to determine the location of PMove in the solution.

#4D4D4D

$\text{Check}$

$\text{NEW PROBLEM}$

Fix position and allow selection for all text objects

Empty all input boxes

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{Drag the point and think about what could cause the water level to change at that part \of the graph.}

#eeeeee

#2E006758

#2EB00020

$\textsf{Water\\ level}$

\text{Select part of graph}

\text{Slide to animate}

$\textsf{Time}$

countQuestion = 0
selectedSegment = NaN
randomOrder = Shuffle({{1, 2, 3, 4, 5}, {1, 4, 3, 2, 5}, {2, 1, 4, 3, 5}, {5, 4, 3, 2, 1}, {2, 5, 4, 1, 3}})
shuffleOrder = Element(randomOrder, Mod[countQuestion, Length[randomOrder]] + 1)
caseNum: Mod[countQuestion + shuffleOrder(1), 6] + 1
expectedSegments = Element({{1}, {2, 6, 10}, {3, 7}, {4, 8}, {5, 9}, {11}}, caseNum)
showsolution = false
AnchorCyl = (-11.805132263304221, -0.5111505614295119)
cMajor: 6.5
cMinor: cMajor / 6
waterBase = Translate(Ellipse[((-sqrt(cMajor^(2) - cMinor^(2))), 0), (sqrt(cMajor^(2) - cMinor^(2)), 0), cMajor], AnchorCyl)
cHeight: 7
maxY: 10
P1: (0, 0)
maxX: 20
PSlide = Point(Segment[(0, 0), (maxX, 0)])
P12: (maxX, 0)
randomLevel = Shuffle({5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7})
waterLevel = Element(randomLevel, Mod[countQuestion, Length[randomLevel]] + 1)
randomFillTime = Shuffle({2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5})
fillTime = Element(randomFillTime, Mod[(2 * countQuestion), Length[randomFillTime]] + 1)
P2: (fillTime, waterLevel)
emptyTime = Element(randomFillTime, Mod[(2 * countQuestion) + 1, Length[randomFillTime]] + 1)
middleTime: maxX - emptyTime - fillTime
randomDisplacement = Shuffle({1, 2})
displacement1 = Element(randomDisplacement, Mod[(2 * countQuestion), Length[randomDisplacement]] + 1)
displacement2 = Element(randomDisplacement, Mod[(2 * countQuestion) + 1, Length[randomDisplacement]] + 1)
randomDistancePercents = Shuffle({{10, 10, 20, 30, 30}, {40, 30, 10, 5, 5}, {20, 20, 20, 20, 20}})
timePercentages = Element(randomDistancePercents, Mod[countQuestion, Length[randomDistancePercents]] + 1)
P3: P2 + ((timePercentages(1) * middleTime / 100) - 0.2, 0)
P4: P3 + (0.2, displacement1)
P5: P4 + ((timePercentages(2) * middleTime / 100) - 0.2, 0)
P6: P5 + (0.2, (-displacement1))
P7: P6 + ((timePercentages(3) * middleTime / 100) - 0.2, 0)
P8: P7 + (0.2, displacement2)
P9: P8 + ((timePercentages(4) * middleTime / 100), 0)
P10: P9 + (0.2, (-displacement2))
P11: P10 + ((timePercentages(5) * middleTime / 100), 0)
displayLine = PolyLine(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12)
PMove = If(PSlide ≟ (0, 0) ∨ PSlide ≟ (20, 0), PSlide, Intersect[x = x(PSlide), displayLine])
waterHeight: (y(PMove / maxY) * cHeight)
waterTop = Translate(waterBase, (0, waterHeight))
pulsing = 0.6 (slider from 0 to 1, step 0.1)
seg1 = Segment(P1, P2)
seg11 = Segment(P11, P12)
seg10 = Segment(P10, P11)
seg9 = Segment(P9, P10)
seg8 = Segment(P8, P9)
seg7 = Segment(P7, P8)
seg6 = Segment(P6, P7)
seg5 = Segment(P5, P6)
seg4 = Segment(P4, P5)
seg3 = Segment(P3, P4)
seg2 = Segment(P2, P3)
randomList2 = Shuffle(Sequence[15])
randomList1 = Shuffle(Sequence[20])
randomNum2 = Element(randomList2, Mod[countQuestion, 15] + 1)
input2: NaN
randomNum1 = Element(randomList1, Mod[countQuestion, 20] + 1)
input1: NaN
validate = false
showanswer = false
tries = 0
countCorrect = 0
showhint = false
correct = Defined(IndexOf[selectedSegment, expectedSegments])
isTypicalError: input2 ≟ input1 + 1
showbuttons = true
typicalError1: 0
typicalError2: 0
showhinttypicalerror = false
textCountCorrect: "\text{Number correct: " + (LaTeX[countCorrect]) + " }"
labelBtnValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
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)}])
textHint: "\text{\color{" + (LaTeX[colorOrange]) + "}\bold{Hint}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\"]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + "}"
layoutY: 448
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
layoutX: 180
layoutAppSize = Corner(5)
inputCurrent: {selectedSegment}
inputSaved: {NaN, NaN}
enableBtnValidate: inputCurrent ≠ inputSaved ∧ inputCurrent ≟ RemoveUndefined[inputCurrent]
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correct}$", "$\text{✕ " + (If[tries < 3, "Try again", "Maybe next time"]) + "}$"]]) + ""
viewbox = Polygon({(0, 0), (maxX, 0), (maxX, maxY), (0, maxY)})
axisY = Segment((0, maxY), (0, 0))
cRadius: 2
cylBase = Translate(CurveCartesian[(cMajor * cos(A)), (cMinor * sin(A)), A, pi, (2 * pi)], AnchorCyl)
cylSides: {Segment[AnchorCyl + (cMajor, 0), AnchorCyl + (cMajor, cHeight)], Segment[AnchorCyl - (cMajor, 0), AnchorCyl - (cMajor, (-cHeight))]}
waterFill = Polygon({AnchorCyl + (cMajor, 0), AnchorCyl + (cMajor, waterHeight), AnchorCyl + ((-cMajor), waterHeight), AnchorCyl + ((-cMajor), 0)})
solnGuide = Segment(PSlide, PMove)
showHotTub: showsolution ∨ showhint
optionsUpperCase: {"The hot tub is filling up with water", "The hot tub is full of water with no people sitting in it", "Someone is getting into the hot tub", "Someone is sitting in the hot tub", "Someone is getting out of the hot tub", "The hot tub is draining water"}
pulsingSpeed: 8
currentSegment = Element({seg1, seg2, seg3, seg4, seg5, seg6, seg7, seg8, seg9, seg10, seg11}, selectedSegment)
onboarding = true
cylTop = Translate(waterBase, (0, cHeight))
pulsingPoint = circlePixels(PSlide, 7 + (pulsing * 7), Corner[1], Corner[3], Corner[5])
onboardingHint = false
solnSegments = Zip(Element[{seg1, seg2, seg3, seg4, seg5, seg6, seg7, seg8, seg9, seg10, seg11}, A], A, expectedSegments)
checkLocation = Zip(x(PMove) < x(A), A, {P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11})
showStep: 11 - Sum[checkLocation]
AnchorTubRight: AnchorCyl + (cMajor + 0.3, (-cMinor) - 0.3)
AnchorTubLeft: AnchorCyl + ((-cMajor) - 0.3, (-cMinor) - 0.3)
pulsingObject = Zip(expandSegment[A, B, (pulsing * 9), Corner[1], Corner[3], Corner[5]], A, {P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11}, B, {P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12})
allPoints: {P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12}
layoutFeedbackY = If(correct, 455, If[tries ≟ 3, 450, layoutY + 1])
layoutFeedbackX: layoutX + If[correct ∨ tries ≟ 3, 175, 126]
explanation: {"The water level increases from zero here.", "The water level is constant here.", "The water level increases for a short time here.", "The water level is constant here.", "The water level decreases for a short time here.", "The water level decreases to zero here."}
coverBox = Polygon({(0, 0), (maxX, 0), (maxX, maxY), (0, maxY)})
optionsLowerCase = Zip(ReplaceAll[ReplaceAll[A, "The", "the"], "Some", "some"], A, optionsUpperCase)
textQuestion: "\text{Here is a graph of the water level in a hot tub over time. Which part of the 
graph represents\\the water level when " + (LaTeX[optionsLowerCase(caseNum)]) + "?}"
textSolution: "\text{\bold{Solution}\\
The segment" + (LaTeX[If[caseNum ≟ 1 ∨ caseNum ≟ 6, "", "s"]]) + " where " + (LaTeX[optionsLowerCase(caseNum)]) + " " + (LaTeX[If[caseNum ≟ 1 ∨ caseNum ≟ 6, "is", "are"]]) + " highlighted \\on the graph. " + (LaTeX[explanation(caseNum)]) + "}"
axisX = Segment((0, 0), (maxX + 1.5, 0))
displayStep: "\text{" + (LaTeX[((If[Defined[IndexOf[showStep, expectedSegments]], "\textbf\textcolor{#006758}{", "{"] * optionsUpperCase(Element[{1, 2, 3, 4, 5, 2, 3, 4, 5, 2, 6}, showStep])) * "}.")]) + "}"
AnchorP1: AnchorTubLeft + (2, waterHeight + 1.5)
AnchorP2: AnchorP1 + (7, 0)
show25: x(P3) < x(PMove) < x(P4) ∨ x(P7) < x(PMove) < x(P8) ∨ x(P5) < x(PMove) < x(P6) ∨ x(P9) < x(PMove) < x(P10)
showPerson1: showHotTub ∧ (x(P3) < x(PMove) < x(P6) ∨ x(P7) < x(PMove) < x(P10))
showPerson2: showHotTub ∧ If[displacement1 > displacement2, x(P3) < x(PMove) < x(P6), x(P7) < x(PMove) < x(P10)]

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: 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: pixelsToDistanceY
pixelsToDistanceY(inputPixels,corner1,corner3,corner5)
Input: inputPixels, Corner1, Corner3, Corner5
Output: outputDistance

Corner1: (-4, -2)
Corner3: (6, 6)
Corner5: (800, 500)
yLeft: y(Corner1)
yRight: y(Corner3)
outputDistance: (inputPixels / y(Corner5) * (yRight - yLeft))

Tool: expandSegment
expandSegment(A,B,pixelGap,Corner1,Corner3,Corner5)
Input: A, B, pixelGap, Corner1, Corner3, Corner5
Output: newPoly

pointGap = pixelsToDistanceX(pixelGap, Corner1, Corner3, Corner5)
xyScale: pixelsToDistanceY[10, Corner1, Corner3, Corner5] / pixelsToDistanceX[10, Corner1, Corner3, Corner5]
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: pixelsToDistanceX (command pixelsToDistanceX1)
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: circlePixels
circlePixels(A,pixelRadius,Corner1,Corner3,Corner5
Input: A, pixelRadius, Corner1, Corner3, Corner5
Output: newCircle

pointRadius = pixelsToDistanceX(pixelRadius, Corner1, Corner3, Corner5)
newCircle = Circle(A, pointRadius)