#4D4D4D

$\text{Check}$

$\text{NEW PROBLEM}$

Fix position and allow selection for all text objects

Empty all input boxes

Reset app

\text{}

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#C75000

#E07415

#eeeeee

#2E006758

#2EB00020

$\math\textsf{Tim has}$

\text{marbles.}

allRandomSeeds = RandomUniform(0, 0.99, 200)
validA = true
inputSaved: {""}
studentAns = NaN
inputCurrent: {stringA}
countQuestion = 0
numRandoms: 3
randIndex: (Mod[countQuestion, floor(Length[allRandomSeeds] / numRandoms)] * numRandoms) + 1
currentRandomSeeds = Take(allRandomSeeds, randIndex, randIndex + numRandoms - 1)
groupSize: 5 + floor((currentRandomSeeds(1) * 6))
numGroupsTotal = Element(Remove[{3, 4, 5, 6, 7, 8, 9, 10}, {groupSize}], 1 + floor((currentRandomSeeds(2) * 6)))
numParts: 1 + floor((currentRandomSeeds(3) * (numGroupsTotal - 1)))
ansVal: (numParts * groupSize)
totalValue: (groupSize * numGroupsTotal)
caseNum: 3
hintNumberLine: "In this model, " + (LaTeX[numGroupsTotal]) + " is being subtracted from " + (LaTeX[totalValue]) + " repeatedly. "
hintArray: "In this model, " + totalValue + " balls have arranged in " + numGroupsTotal + " rows. "
hintGroups: "In this model, " + (LaTeX[totalValue]) + " items are arranged in groups of  " + (LaTeX[numGroupsTotal]) + ". "
Anchor1 = (-30.31957976411415, -11.19764943527981)
onboarding = true
validate = false
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
correct: studentAns ≟ ansVal
showbuttons = true
showhinttypicalerror = false
textCountCorrect: "\text{Number correct: " + (LaTeX[countCorrect]) + " }"
labelBtnValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
enableBtnValidate: inputCurrent ≠ inputSaved ∧ validA ∧ (¬(stringA ≟ "" ∨ stringA ≟ "?"))
helpTextHint: "\text{Use the model to help find \(\dfrac{" + (LaTeX[numParts]) + "}{" + (LaTeX[numGroupsTotal]) + "}\) of \(" + (LaTeX[totalValue]) + "\).}"
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16
pixelsTop: 24
textHint: "\text{\color{" + (LaTeX[colorOrange]) + "}\bold{Hint}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\"]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + "}"
layoutY = 91
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
layoutX: 250
layoutAppSize = Corner(5)
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correct}$", "$\text{✕ " + (If[tries < 3, "Try again", "Maybe next time"]) + "}$"]]) + ""
onboardingX: 400
onboardingY: 148
onboardingCase: 2
layoutXFeedback: layoutX + If[correct ∨ tries ≟ 3, 20, 126]
arrayDisplay = Sequence(Sequence[Anchor1 + ((2 * j), i), i, 0, groupSize - 1], j, numGroupsTotal - 1, 0, -1)
boxOutlines = Zip(Polygon[{Element[A, 1] + (1, -1), Element[A, Length[A]] + (1, 1), Element[A, Length[A]] + (-1, 1), Element[A, 1] + (-1, -1)}], A, arrayDisplay)
textQuestion: "\text{Mary has " + (LaTeX[totalValue]) + " marbles. She gives \[\frac{ " + (LaTeX[numParts]) + "}{" + (LaTeX[numGroupsTotal]) + "}\] of the marbles to Tim. How many marbles does Tim have?}"
textSolution: "\textsf{\bold{Possible Solution}}\\
\dfrac{" + (LaTeX[numParts]) + "}{" + (LaTeX[numGroupsTotal]) + "}\textsf{ of }\(" + (LaTeX[totalValue]) + "=\dfrac{" + (LaTeX[numParts]) + "}{" + (LaTeX[numGroupsTotal]) + "}\times " + (LaTeX[totalValue]) + "=" + (LaTeX[ansVal]) + "\)"
isTypicalError: false
ansBox = Textfield(studentAns)
showArray: showhint ∨ showsolution
layoutXHint: 11
layotuX: 230
BoxAnchor: Anchor1 + (-1, -1)
correctFracDisplay = Take(arrayDisplay, 1, numParts)
solnPart2 = Zip(Circle[A, 0.4], A, Flatten[Take[arrayDisplay, numParts + 1]])

Tool: PointToPixels (command PointToPixelsOLD)
PointToPixels(InputPoint,Corner1,Corner3,Corner5)
Input: InputPoint, Corner1, Corner3, Corner5
Output: OutputPixels

xLeft: x(Corner1)
xRight: x(Corner3)
yTop: y(Corner3)
yBottom: y(Corner1)
yPixels: (y(Corner5) * (yTop - y(InputPoint)) / (yTop - yBottom))
xPixels: (x(Corner5) * (x(InputPoint) - xLeft) / (xRight - xLeft))
OutputPixels: (xPixels, yPixels)

Tool: sectorPixels
sectorPixels(Midpoint,B,C,pixelRadius,Corner1,Corner3,Corner5
Input: A, B, C, pixelRadius, Corner1, Corner3, Corner5
Output: newSector

pointRadius: (pixelRadius / x(Corner5) * (x(Corner3) - x(Corner1)))
BPrime: A + (pointRadius * UnitVector[B - A])
newSector = CircleSector(A, BPrime, C)

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

this is dynamic centered text

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

Tool: listToValue
listToValue(digitList)
Input: inputList
Output: finalNumber

inputList: {3, 4, 5}
numDigits = Length(inputList)
reverseInput = Reverse(inputList)
numericValues = Sequence((reverseInput(A) * 10^(A - 1)), A, 1, numDigits)
finalNumber = Sum(numericValues)

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

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)