#4D4D4D

$\text{Check}$

$\text{NEW PROBLEM}$

Fix position and allow selection for all text objects

Empty all input boxes

\text{\bold{Possible Solution}\ This is the solution}

$\math{x=}\vphantom{b}$

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{Observe the tape diagram.}

#eeeeee

#2E006758

#2EB00020

$\bold{x}$

$\bold{x}$

savedValue = 15
showsolution = false
countQuestion = 0
allProblTypeAndC = Shuffle({1, 2, 3, 4})
problType = Element(allProblTypeAndC, Mod[countQuestion, Length[allProblTypeAndC]] + 1)
allA = Shuffle(2…10)
valA = Element(allA, Mod[countQuestion, Length[allA]] + 1)
allB = Shuffle(Sequence[valA + 1, 21])
valB = Element(allB, Mod[countQuestion, Length[allB]] + 1)
dummyA1 = Sequence(n, n, 2, Min[valB - 1, 10])
allA1 = RemoveUndefined(Zip[If[GCD[valB, n] ≟ 1, n], n, dummyA1])
valA1 = Element(allA1, Mod[countQuestion, Length[allA1]] + 1)
allC: {valA1, (2 * valA1), (3 * valA1)}
valC = Element(allC, Mod[countQuestion, Length[allC]] + 1)
correctForDisplay = If(problType ≟ 1, savedValue ≟ valB - valA, problType ≟ 2, savedValue ≟ valB + valA, problType ≟ 3, savedValue ≟ valB / valA, problType ≟ 4, savedValue ≟ ((valC * valB)) / valA1)
T1 = (0, 0)
lTape: 20
T2: T1 + (lTape, 0)
textAns3: "x=" + (LaTeX[FractionText[valB / valA]]) + ""
unit = If(problType ≟ 1, Distance[T1, T2] / valB, problType ≟ 2, Distance[T1, T2] / (valA + valB), problType ≟ 4, Distance[T1, T2] / valB, 1)
hTape: 4
T11: T1 + (((valB - valA) * unit), 0)
T41: (x(T11), hTape)
T3: T2 + (0, hTape)
T4: (x(T1), y(T3))
distLine: 2.5
textEq4: "\frac{" + (LaTeX[valA1]) + "}{" + (LaTeX[valB]) + "}x=" + (LaTeX[valC]) + ""
textEq3: "" + (LaTeX[valA]) + "x=" + (LaTeX[valB]) + ""
textEq2: "x-" + (LaTeX[valA]) + "=" + (LaTeX[valB]) + ""
textEq1: "x+" + (LaTeX[valA]) + "=" + (LaTeX[valB]) + ""
inputSaved: {NaN}
input1 = NaN
inputCurrent: {input1}
validate = false
showanswer = false
tries = 0
countCorrect = 0
showhint = false
InputBox1 = Textfield(input1)
correct1 = If(problType ≟ 1, input1 ≟ valB - valA, problType ≟ 2, input1 ≟ valB + valA, problType ≟ 3, input1 ≟ valB / valA, problType ≟ 4, input1 ≟ ((valC * valB)) / valA1)
correct: correct1
showbuttons = true
typicalError1: 0
typicalError2: 0
showhinttypicalerror: false
textCountCorrect: "\text{Number correct: " + (LaTeX[countCorrect]) + " }"
labelBtnValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
enableBtnValidate: inputCurrent ≠ inputSaved ∧ inputCurrent ≟ RemoveUndefined[inputCurrent]
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: 178
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
layoutX: 16
layoutAppSize = Corner(5)
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correct}$", "$\text{✕ " + (If[tries < 3, "Try again", "Maybe next time"]) + "}$"]]) + ""
L1: T1 - (0, distLine)
L2: (x(T2), y(L1))
rhs = Segment(L1, L2)
tape, t1, t2, t3, t4 = Polygon(T1, T2, T3, T4)
rectXType1, f, g, h, i = Polygon(T1, T11, T41, T4)
rectConstType1, j, k, l, m = Polygon(T11, T2, T3, T41)
lConstTape = Distance(T1, T2)
lHorCutsType3: lConstTape / valA
labelA1: "" + (LaTeX[valA]) + ""
labelB1: "" + (LaTeX[valB]) + ""
T12: T1 + ((valB * unit), 0)
T42: (x(T12), hTape)
rectBType2, n, t12, t42, p = Polygon(T1, T12, T42, T4)
rectAType2, q, r, s, t = Polygon(T12, T2, T3, T42)
labelB2: "" + (LaTeX[valB]) + ""
labelA2: "" + (LaTeX[valA]) + ""
textAns1: "x=" + (LaTeX[valB - valA]) + ""
textAns2: "x=" + (LaTeX[valB + valA]) + ""
textAns4: "x=" + (LaTeX[FractionText[(valC * valB / valA1)]]) + ""
labelB3: "" + (LaTeX[valB]) + ""
unitCutsType3 = Sequence(Polygon[(i + x(T1), y(T1)), (i + x(T1) + lHorCutsType3, y(T1)), (i + x(T1) + lHorCutsType3, y(T3)), (i + x(T1), y(T3))], i, 0, lConstTape - lHorCutsType3, lHorCutsType3)
M1 = Midpoint(T1, T4)
M2 = Midpoint(T2, T3)
allMidpoints = If(¬showanswer, Sequence[M1 + (i / ((2 * valA)) * (M2 - M1)), i, 1, (2 * valA), 2], Sequence[M1 + (i / ((2 * valA)) * (M2 - M1)), i, 1, (2 * valA), 2])
labelX3: "" + (LaTeX[If[(¬showsolution) ∧ (¬correctForDisplay), "x", FractionText[valB / valA, true]]]) + ""
allLabelsX3 = Sequence(labelX3, n, 1, Length[allMidpoints])
LT1: T4 + (0, 2.5)
LT2: T3 + (0, 2.5)
xtype4 = Segment(LT1, LT2)
lHorCutsType4: lConstTape / valB
unitCutsType4 = Sequence(Polygon[(i + x(T1), y(T1)), (i + x(T1) + lHorCutsType4, y(T1)), (i + x(T1) + lHorCutsType4, y(T3)), (i + x(T1), y(T3))], i, 0, lConstTape - lHorCutsType4, lHorCutsType4)
T14: T1 + ((valA1 * unit), 0)
rectRemoveType4, t14, c, d, e = Polygon(T14, T2, T3, (x(T14), y(T14) + hTape))
L4: (x(T14), y(L1))
rhsType4 = Segment(L1, L4)
labelRHS4: "" + (LaTeX[valC]) + ""
denX4 = Denominator((valC * valB / valA1))
unitCutsType4Grayed = Sequence(Polygon[(i + x(T1), y(T1)), (i + x(T1) + lHorCutsType4, y(T1)), (i + x(T1) + lHorCutsType4, y(T3)), (i + x(T1), y(T3))], i, (lHorCutsType4 * valA1), lConstTape - lHorCutsType4, lHorCutsType4)
allLabelsType3 = Sequence(Text[allLabelsX3(A), allMidpoints(A) + If[¬showsolution, ((-0.3 * unit), 0.5), ((-0.5 * unit), 1)], true, true], A, 1, Length[allMidpoints])
textQuestion: "\textsf{Solve the equation:}\\
\phantom{“\[\frac{2}{3}\]”}" + (LaTeX[If[problType ≟ 1, textEq1, problType ≟ 2, textEq2, problType ≟ 3, textEq3, problType ≟ 4, textEq4]]) + " "
textAnswer: "\textsf\bold{Answer}\\\\" + (LaTeX[If[problType ≟ 1, textAns1, problType ≟ 2, textAns2, problType ≟ 3, textAns3, problType ≟ 4, textAns4]]) + ""
T31: (lHorCutsType3, 6)
xtype3 = Segment((0, 6), T31)
sumAB: valB + valA
diffBA: valB - valA
xtype1 = Segment((0, 6), (x(T11), 6))
PX4 = If(showsolution, Midpoint[LT1, LT2] - (1.5, 0) + If[denX4 ≠ 1, (-0.5, 2.5), (-0.5, 1.5)], Midpoint[LT1, LT2] - (1.5, 0) + If[denX4 ≠ 1, (-0.5, 2.5), (-0.5, 1.5)])
labelX4: "" + (LaTeX[If[(¬showsolution) ∧ (¬correctForDisplay), "x", ("x=" * FractionText[(valC * valB / valA1), true])]]) + ""
labelX2: "" + (LaTeX[If[(¬showsolution) ∧ (¬correctForDisplay), "x", ("x=" * sumAB)]]) + ""
labelX1: "" + (LaTeX[If[(¬showsolution) ∧ (¬correctForDisplay) ∧ tries ≠ 3, x, diffBA]]) + ""

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)