$\textsf{%n = %v}$

#DA2570

#0F8538

$\textsf{NEW QUESTION}$

Organize

MovableBox1

\textsf{Anna earns \$\hspace{80} per hour. She works \hspace{80} hours this week.}\\\\textsf{How much will she earn.}

\textsf{There are \hspace{80} mangoes. Mangoes weigh \hspace{80} pounds each.}\\\\textsf{How much will the mangoes weigh in total?}

\textsf{A cruise travels \hspace{80} miles per hour. It travels for \hspace{80} hours.}\\\\textsf{
How far will it travel in that time?}

reset

\text{Drag into the boxes}

1 = arrow left, 2 = arrow right, 3 = arrow uo, 4 = arrow down

pulsing = 0.56 (slider from 0 to 1, step 0.01)
mangosRand = Shuffle(Sequence[2, 20])
questionCount = 0
timeRand = Shuffle(KeepIf[¬IsInteger[kk], kk, Sequence[2, 15, If[Mod[questionCount, 5] ≟ 0, 0.01, 0.1]]])
hoursRand = Shuffle(Sequence[20, 50, 0.1])
earningsRand = Shuffle(Sequence[16, 60, If[Mod[questionCount, 5] ≟ 0, 0.01, 0.1]])
questionRand = Shuffle(Flatten[Sequence[Sequence[3], ii, 1, 5]])
weightRand = Shuffle(Sequence[0.3, 4.9, 0.1] \ {1, 2, 3, 4})
speedRand = Shuffle(Sequence[20, 30, If[Mod[questionCount, 5] ≟ 0, 0.01, 0.1]])
posOptions = Shuffle(Flatten[Sequence[Sequence[2], ii, 1, 10]])
MovBoxCorner1 = (3.6, 5.8)
MovableBox1 = makeBox(MovBoxCorner1, 1.5, 0.65)
anim = 0 (slider from 0 to numDecimalsNum1 + numDecimalsNum2, step 1)
Step = 1 (slider from 1 to 3, step 1)
mangos = Element(mangosRand, Mod[questionCount, Length[mangosRand]] + 1)
time = Element(timeRand, Mod[questionCount, Length[timeRand]] + 1)
earning = Element(earningsRand, Mod[questionCount, Length[earningsRand]] + 1)
hours: Element[hoursRand, Mod[questionCount, Length[hoursRand]] + 1] + If[IsInteger[earning] ∧ IsInteger[Element[hoursRand, Mod[questionCount, Length[hoursRand]] + 1]], 0.1, 0]
question = If(questionCount ≟ 0, 2, Element[questionRand, Mod[questionCount, Length[questionRand]] + 1])
num2 = Element({hours, mangos, time}, question)
numDecimalsNum2 = Max(Length[Text[num2 - floor(num2)]] - 2, 0)
num2NoDec: (num2 * 10^(numDecimalsNum2))
weight = Element(weightRand, Mod[questionCount, Length[weightRand]] + 1)
speed = Element(speedRand, Mod[questionCount, Length[speedRand]] + 1)
num1 = Element({earning, weight, speed}, question)
numDecimalsNum1 = Max(Length[Text[num1 - floor(num1)]] - 2, 0)
num1NoDec: (num1 * 10^(numDecimalsNum1))
calculations: "\begin{array}{r}" + (LaTeX[If[Step ≟ 1, num1NoDec, num1]]) + "\\\\\times\hspace{10}" + (LaTeX[If[Step ≟ 1, num2NoDec, num2]]) + "\end{array}"
productNoDec: (num1NoDec * num2NoDec)
prodNoDecText = Text(Text[productNoDec], Corner[calculations, 2], true, true, -1, -1)
l2 = Insert(TextToUnicode["."], TextToUnicode[prodNoDecText], anim - numDecimalsNum1 - numDecimalsNum2 - 1)
l3 = Take(l2, IndexOf[46, l2] + 1)
l4 = Zip(("\underset{\rotatebox{180}{\curvearrowright}}" * UnicodeToText[{KK}]), KK, l3)
arrowBelow: "\color{" + (LaTeX[colorPink]) + "}" + (LaTeX[(((((If[Length[l4] ≥ 1, l4(1), ""] * If[Length[l4] ≥ 2, l4(2), ""]) * If[Length[l4] ≥ 3, l4(3), ""]) * If[Length[l4] ≥ 4, l4(4), ""]) * If[Length[l4] ≥ 5, l4(5), ""]) * If[Length[l4] ≥ 6, l4(6), ""])]) + ""
l1 = Take(l2, 1, IndexOf[46, l2] - 1)
positionOption: 1
sentence2Options: {(("For working " * hours) * " hours, she will earn"), (mangos * " mangos will weigh"), (("In " * time) * " hours will travel")}
sentence1Options: {"For working one hour Anna earns", "A mango weighs", "The cruise travels in one hour"}
AppSize = Corner(5)
MoveGuideLine = (8.913, 0.93856)
hGuideline: y = y(MoveGuideLine)
vGuideline: x = x(MoveGuideLine)
MovBoxCorner2 = (-2.3, 5.8)
MovableBox2 = makeBox(MovBoxCorner2, 1.5, 0.65)
sentence1: "\text{" + (LaTeX[sentence1Options(question)]) + ":}"
TargetBoxCorner1 = Corner(sentence1, 2)
targetBoxModel = makeBox((0, 0), 1.7, -0.85)
sentence2: "\text{" + (LaTeX[sentence2Options(question)]) + ": \hspace{100}\times}"
TargetBoxCorner3 = Corner(sentence2, 2)
targetBox1 = Translate(targetBoxModel, TargetBoxCorner1)
targetBox3 = Translate(targetBoxModel, TargetBoxCorner3)
TargetBoxCorner2 = Translate(TargetBoxCorner3, (-0.6, 0))
targetBox2 = Mirror(targetBox3, LineBisector[TargetBoxCorner3, TargetBoxCorner2])
movTexts1: {Text[earning], Text[weight], Text[speed]}
movTexts2: {Text[hours], Text[mangos], Text[time]}
colorPurpleLight: {133, 117, 255} / 255
colorPurpleDark: {81, 69, 210} / 255
movableText1 = Text(centerText["50 px", movTexts1(question)], MovBoxCorner1 + (0, 0.25), true, true, 1, -1)
movableText2 = Text(centerText["50 px", movTexts2(question)], MovBoxCorner2 + (0, 0.25), true, true, 1, -1)
Point1: (Element[{-1.8, 3.6, -1.4}, question], 5.8)
Cor1 = (-4.319999999999999, -3.719999999999997)
Cor3 = (11.719999999999995, 6.319999999999998)
Point1': (Element[{3.2, -2.3, 4.9}, question], 5.8)
MovBoxCorner3 = (3.6, 5.8)
MovableBox3 = makeBox(MovBoxCorner3, 1.5, 0.65)
fixedText2 = Text(centerText["50 px", movTexts2(question)], If[positionOption ≟ 1, Point1', Point1] + (0, 0.25), true, true, 1, -1)
fixedText1 = Text(centerText["50 px", movTexts1(question)], If[positionOption ≟ 1, Point1, Point1'] + (0, 0.25), true, true, 1, -1)
movableText3 = Text(centerText["50 px", movTexts1(question)], MovBoxCorner3 + (0, 0.25), true, true, 1, -1)
object1InRegion: true ∈ Zip[IsInRegion[n, targetBox1], n, Sequence[Vertex[MovableBox1, k], k, 1, 4]]
object2InRegion: true ∈ Zip[IsInRegion[n, targetBox2], n, Sequence[Vertex[MovableBox2, k], k, 1, 4]]
object3InRegion': true ∈ Zip[IsInRegion[n, targetBox2], n, Sequence[Vertex[MovableBox3, k], k, 1, 4]]
object3InRegion: true ∈ Zip[IsInRegion[n, targetBox3], n, Sequence[Vertex[MovableBox3, k], k, 1, 4]]
object2InRegion': true ∈ Zip[IsInRegion[n, targetBox3], n, Sequence[Vertex[MovableBox2, k], k, 1, 4]]
stepsTexts: {"Multiply ignoring the decimals. Do NOT align decimals.", "Count decimal places in the problem.", "Put decimal point in answer."}
product: (num1 * num2)
numDecimalsProd = Max(Length[Text[product - floor(product)]] - 2, 0)
contDec1: "\textsf{\bold{\textcolor{" + (LaTeX[colorPink]) + "}{←}} " + (LaTeX[numDecimalsNum1]) + " decimal" + (LaTeX[If[numDecimalsNum1 ≟ 1, "", "s"]]) + "
}"
corCalc3 = Corner(calculations, 3)
vel: 5
textResultDec: "" + (LaTeX[UnicodeToText[l1]]) + "\color{" + (LaTeX[colorPink]) + "}\bold{\tiny{∙}}" + (LaTeX[If[anim ≤ numDecimalsNum1 + numDecimalsNum2 - 1, arrowBelow, ""]]) + ""
contDec3: "\textsf{\bold{\textcolor{" + (LaTeX[colorPink]) + "}{←}} " + (LaTeX[numDecimalsNum1]) + " + " + (LaTeX[numDecimalsNum2]) + " = " + (LaTeX[numDecimalsNum1 + numDecimalsNum2]) + " decimal" + (LaTeX[If[numDecimalsNum1 + numDecimalsNum2 ≟ 1, "", "s"]]) + "}"
textResultConditional: "\text{" + (LaTeX[If[Step ≠ 3 ∧ anim ≤ numDecimalsNum1 + numDecimalsNum2 - 1, prodNoDecText, textResultDec]]) + "}"
contDec2: "\textsf{\bold{\textcolor{" + (LaTeX[colorPink]) + "}{←}} " + (LaTeX[numDecimalsNum2]) + " decimal" + (LaTeX[If[numDecimalsNum2 ≟ 1, "", "s"]]) + "
}"
correct: object2InRegion ∧ object3InRegion ∨ object3InRegion' ∧ object2InRegion'
numBox = 1
correct2: object2InRegion ∧ object3InRegion
correct3: object2InRegion ∧ object3InRegion
Pos1: Vertex[targetBox1, 4] + (0.1, -0.1)
Pos2: Vertex[targetBox2, 3] + (0.1, -0.1)
Pos3: Vertex[targetBox3, 4] + (0.1, -0.1)
Loc2 = If(object1InRegion ∧ object2InRegion ∧ (¬object3InRegion'), Pos2, object1InRegion ∧ object2InRegion' ∧ (¬object3InRegion), Pos3, If[positionOption ≟ 1, Point1', Point1])
Loc3 = If(object1InRegion ∧ (¬object2InRegion) ∧ object3InRegion', Pos2, object1InRegion ∧ (¬object2InRegion') ∧ object3InRegion, Pos3, If[positionOption ≟ 1, Point1, Point1'])
Loc1 = If(object1InRegion, Pos1, If[positionOption ≟ 1, Point1, Point1'])
allLocations: {Loc1, Loc2, Loc3}
stepByStepSol: "\text{\bold{Step " + (LaTeX[Step]) + "}:\\" + (LaTeX[stepsTexts(Step)]) + "}"
labelBtnPrev: "\textsf{\large{\triangleleft}\normalsize{\hspace{10} STEP " + (LaTeX[Step - 1]) + " }}"
labelBtnNext: "\textsf{STEP " + (LaTeX[Step + 1]) + " \hspace{10}\large\triangleright}"
xBtnNext = If(Step ≟ 1, 16, (16 * 2) + 110)
mangoes1 = TableText({"One mango weighs", "", "lbs."}, "l", 80, 50)
mangoes2 = TableText({"How much will ", "", "mangoes weigh?"}, "l", 80, 50)
anna1 = TableText({"\textsf{Anna earns $}", "", "\textsf{per hour.}"}, "l", 80, 50)
anna2 = TableText({"\textsf{She works}", "", "\textsf{hours this week.}"}, "l", 80, 50)
question2: "" + (LaTeX[mangoes1]) + "\\" + (LaTeX[mangoes2]) + ""
cruise1 = TableText({"\textsf{A cruise travels}", "", "\textsf{miles per hour and maintains constant speed. }"}, "l", 80, 50)
cruise2 = TableText({"\textsf{How many miles will it travel in}", "", "\textsf{hours? }"}, "l", 80, 50)
question3: "" + (LaTeX[cruise1]) + "\\" + (LaTeX[cruise2]) + ""
question1: "" + (LaTeX[anna1]) + "" + (LaTeX[anna2]) + "\\\hspace{8}\textsf{How much will she earn?}"
hGuideline' = Translate(hGuideline, Vector[(Vector[Corner[4], Corner[1]] / 500 * 16)])
digits = Length(Zip[UnicodeToLetter[tt], tt, TextToUnicode[Text[num2NoDec]]])
l5 = Reverse(Sequence[abs((10 * floor(num2NoDec / 10^(n + 1))) - floor(num2NoDec / 10^(n))), n, 0, digits - 1])
l6 = Zip((kk * 10^(digits - nn)), kk, l5, nn, Sequence[digits])
multipSteps = Zip((num1NoDec * kk), kk, l6)
multipStepsTable = TableText(Reverse[multipSteps], "vr")
textProduct: "\begin{tabular}{rl}" + (LaTeX[num1]) + "& " + (LaTeX[If[Step ≥ 2, contDec1, ""]]) + "\\
\underline{\hspace{15}\times\hspace{10} " + (LaTeX[num2]) + " }& " + (LaTeX[If[Step ≥ 2, contDec2, ""]]) + "" + (LaTeX[If[digits ≥ 2, (("\\\underline{\hspace{15}" * multipStepsTable) * "\hspace{-5}\\}"), ""]]) + "\\" + (LaTeX[textResultConditional]) + "&" + (LaTeX[If[Step ≥ 3, contDec3, ""]]) + "
\end{tabular}"
onboarding = true
onboardingX_{1}: 436
onboardingY_{1}: 96
onboardingCase_{1} = 3
OnboardingTextOffset_{1} = onboardingTextOffset(Corner[onboardingText_{1}, 1], Corner[onboardingText_{1}, 3], onboardingCase_{1}, Corner[1], Corner[3], Corner[5])
onboardingDisplayText_{1}: "\text{\vphantom{Og}" + (LaTeX[onboardingText_{1}]) + "}"
pulsingSpeed: 8
FixedPoints: {Point1, Point1', Loc1, Loc2, Loc3}
Box1InMov: ¬Defined[IndexOf[MovBoxCorner1, FixedPoints]]
Box2InMov: ¬Defined[IndexOf[MovBoxCorner2, FixedPoints]]
Box3InMov: ¬Defined[IndexOf[MovBoxCorner3, FixedPoints]]
pulsingObject = expandQuad(Vertex[MovableBox1, 4], Vertex[MovableBox1, 3], Vertex[MovableBox1, 2], Vertex[MovableBox1, 1], (7 * pulsing), Corner[1], Corner[3], Corner[5])
pulsingObject2 = expandQuad(Vertex[MovableBox2, 4], Vertex[MovableBox2, 3], Vertex[MovableBox2, 2], Vertex[MovableBox2, 1], (7 * pulsing), Corner[1], Corner[3], Corner[5])
object1InRegion': true ∈ Zip[IsInRegion[n, targetBox1], n, Sequence[Vertex[MovableBox2, k], k, 1, 4]]
target1Active: object1InRegion ∧ Box1InMov ∨ object1InRegion' ∧ Box2InMov
target2Active: object2InRegion ∧ Box2InMov ∨ object3InRegion' ∧ Box3InMov
target3Active: object3InRegion ∧ Box3InMov ∨ object2InRegion' ∧ Box2InMov

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: centerText
centerText(sizeStr,textStr)
Input: sizeStr, textString
Output: centeredLatex

this is dynamic centered text

centeredLatex: (((("\begin{tabular}\hspace{" * sizeStr) * "}\\") * textString) * "\end{tabular}")

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: onboardingTextOffset (command onboardingTextOffset1)
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)