#5991FF

$\textsf{Select the decimal equivalent:}$

$\textbf\textsf{TRY ANOTHER}$

0~.

0

0

0

0

0

0

\textsf{The remainder is 0, so we are finished dividing.}

\textsf{Remainder}

\textsf{Remainder}

\textsf{Remainder}

\text{✓ Correct}

\text{Try Again}

$\textsf{Remainder}$

\text{Select}

randomDigits = Shuffle(Join[Sequence[{A, A, A, A, A, A, A, A, A, A}, A, 1, 9]])
randomPairs = Shuffle({{1, 2}, {1, 4}, {2, 4}, {3, 4}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {3, 6}, {1, 8}, {2, 8}, {3, 8}, {4, 8}, {5, 8}, {6, 8}, {7, 8}})
step = 1
randIndex = 3
numer = Element(randomPairs, randIndex, 1)
denom = Element(randomPairs, randIndex, 2)
ansTenths: floor((numer * 10 / denom))
digitTenths: "\text{" + (LaTeX[If[step > 0, ("" * ansTenths), ""]]) + "}"
ansHundredths: floor((numer * 100 / denom)) - (10 * ansTenths)
ansThousandths: floor((numer * 1000 / denom)) - (100 * ansTenths) - (10 * ansHundredths)
numDP = If(ansThousandths ≠ 0, 3, If[ansHundredths ≠ 0, 2, 1])
digitThousandths: "" + (LaTeX[If[step > 5 ∧ numDP ≟ 3, ("" * ansThousandths), ""]]) + ""
digitHundredths: "\textsf{" + (LaTeX[If[step > 1 ∧ numDP ≥ 2, ("" * ansHundredths), ""]]) + "}"
options: {"\phantom{0.234}", ("0." * digitTenths), ("0." * If[numDP ≥ 2, (digitTenths * digitHundredths), ("0" * digitTenths)]), ("0." * If[numDP ≥ 3, ((digitTenths * digitHundredths) * digitThousandths), If[numDP ≟ 2, (("0" * digitTenths) * digitHundredths), ("00" * digitTenths)]])}
selectDecimal = Zip((("$\text{" * A) * "~}$"), A, options)
row3: (denom * ansHundredths)
row1: (denom * ansTenths)
row2: (100 * numer) - (10 * row1)
hundredths: randomDigits(randIndex + 1)
AnchorDiv = (2, 2)
boxTemplate = Polygon({(0, 0), (0, 1), (1, 1), (1, 0)})
boxesDividend = Sequence(Translate[boxTemplate, AnchorDiv + (A, 0)], A, 0, 3)
zeroIndex: 0
denomPlaced = false
numerPlaced = false
boxUnits: boxesDividend(1)
update: boxesDividend(2)
boxHundredths: boxesDividend(3)
boxThousandths: boxesDividend(4)
currentPlace: 2
zeroPlace = If(numerPlaced ∧ denomPlaced, 2 + zeroIndex, NaN)
divLine1 = Segment(AnchorDiv + (0, -1), AnchorDiv + (2, -1))
divLine2 = Segment(AnchorDiv + (1, -3), AnchorDiv + (3, -3))
divLine5 = Segment(AnchorDiv + (2, -5), AnchorDiv + (4, -5))
allBoxNames: {"box11", "box12", "box21", "box22", "box31", "box32", "box41", "box42", "box51", "box52", "box61"}
cmdEmptyLabels = Zip((("SetCaption(" * A) * ",emptyLabel)"), A, allBoxNames)
allDivLines: {divLine1, divLine2, divLine5}
Row1: {"", "0~.", "3", "7", "5"}
Row2: {"8", "5~", "0", "0", "0"}
blankRow: {"", "", "", "", ""}
digits1: {3, 4}
caption31: 5
caption41: 7
caption42: 8
caption51: 3
caption52: 4
caption61: 1
caseNum = 3
textStep3: "\textbf{Step 3:} Select the \textbf\textcolor{" + (LaTeX[HIGHLIGHT]) + "}{tenths} position to continue."
showDivisor: step > 1
showUnits: step > 2
showTenths: step > 3
showHundredths: step > 4
showThousandths: step > 5
divisorLatex: "" + (LaTeX[denom]) + ""
numerLatex: "" + (LaTeX[numer]) + ""
allAnchors = Zip(AnchorDiv + (0.15, -0.1) + A, A, {(0, 0), (1, 0), (1, -1), (2, -1), (1, -2), (2, -2), (2, -3), (3, -3), (2, -4), (3, -4), (3, -5), (0, 2), (1, 2), (2, 2), (3, 2), (-1, 1), (0, 1), (1, 1), (2, 1), (3, 1)})
digit12: "" + (LaTeX[row1 - (floor(row1 / 10) * 10)]) + ""
digit31: "" + (LaTeX[floor(row3 / 10)]) + ""
digit32: "" + (LaTeX[row3 - (floor(row3 / 10) * 10)]) + ""
digit21: "" + (LaTeX[row2 / 10]) + ""
row4: ((row2 - row3) * 10)
digit41: "" + (LaTeX[row4 / 10]) + ""
row5: (ansThousandths * denom)
digit51: "" + (LaTeX[floor(row5 / 10)]) + ""
digit52: "" + (LaTeX[row5 - (floor(row5 / 10) * 10)]) + ""
allDone = Element({numDP ≟ 1, numDP ≟ 2, numDP ≟ 3}, step - 3)
textStep4: "\text{\textbf{Step 4:} The remainder is not zero yet! So, select the \textbf\textcolor{" + (LaTeX[HIGHLIGHT]) + "}{hundredths} position to \\
\hspace{27mm}continue.}"
textStep2: "\text{\textbf{Step 2:} Select the correct position for the \textbf
\textbf\textcolor{" + (LaTeX[HIGHLIGHT]) + "}{numerator} in the long division \\
\hspace{27mm}statement.}"
textStep1: "\text{\textbf{Step 1:} Select the correct position for the \textbf\textcolor{" + (LaTeX[HIGHLIGHT]) + "}{denominator} in the long division \\
\hspace{27mm}statement.}"
textStep5: "\text{\textbf{Step 5:} The remainder is not zero yet! So select the \textbf\textcolor{" + (LaTeX[HIGHLIGHT]) + "}{thousandths} position to\\
\hspace{27mm}continue.}"
textInstruc: "\textsf{" + (LaTeX[If[¬allDone, Element[{textStep1, textStep2, textStep3, textStep4, textStep5}, step], ""]]) + "}"
correct: SelectedIndex[selectDecimal] ≟ numDP + 1
studentAns: SelectedIndex[selectDecimal] - 1
digit11: "" + (LaTeX[If[row1 ≥ 10, ("" * floor(row1 / 10)), ""]]) + ""
textQuestion: "\textsf{Convert \(\dfrac{" + (LaTeX[numer]) + "}{" + (LaTeX[denom]) + "}\) to a decimal using long division.}"
questionCaption: "\dfrac{" + (LaTeX[If[step ≟ 2, (((("\textbf\textcolor{" * HIGHLIGHT) * "}{") * numer) * "}"), ("" * numer)]]) + "}{" + (LaTeX[If[step ≟ 1, (((("\textbf\textcolor{" * HIGHLIGHT) * "}{") * denom) * "}"), ("" * denom)]]) + "}=" + (LaTeX[If[¬allDone, "?", ""]]) + ""
colorHighlightR: 101 / 255
colorHighlightG: 87 / 255
colorHighlightB: 210 / 255
boxHundredthsOutline: boxHundredths
boxTenthsOutline: update
boxThousandthsOutline: boxThousandths
boxUnitsOutline: boxUnits
arrow1 = Segment(AnchorDiv + (2.5, 0), AnchorDiv + (2.5, -1))
arrow2 = Segment(AnchorDiv + (3.5, 0), AnchorDiv + (3.5, -3))
vRemainder3 = Segment(AnchorDiv + (0, -5.55), AnchorDiv + (3, -5.55))
vRemainder2 = Segment(AnchorDiv + (0, -3.55), AnchorDiv + (2, -3.55))
vRemainder1 = Segment(AnchorDiv + (0, -1.55), AnchorDiv + (1, -1.55))
digitQ1: "" + (LaTeX[numer]) + "" + (LaTeX[If[step ≥ 3, "~.", ""]]) + ""
onboarding: studentAns ≟ 0 ∧ randIndex ≟ 1 ∧ allDone
pulsing = 0.1 (slider from 0 to 1, step 0.1)
boxDivisor = Translate(boxTemplate, AnchorDiv + (-1.3, 0))
boxDivisorOutline: boxDivisor
pulsingSpeed: 8

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)