#6557D2

#252525

\text{Click to start}

#4D4D4D

$\text{Check}$

$\text{NEW PROBLEM}$

Fix position and allow selection for all text objects

Empty all input boxes

$b=$

Reset app

#006758

#B00020

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#8575FF

#903D14

#BD6C43

#C75000

#E07415

\text{Use the slider above to count square units.}

#eeeeee

#2E006758

#2EB00020

\text{square units}

\text{Slide to count square units}

\text{Area}=\vphantom{b}

\textsf{Simplify your answer.}

allRandomSeeds = RandomUniform(0, 0.99, 200)
tempInput1 = NaN
input1 = NaN
InputBox1 = Textfield(input1)
countQuestion = 0
animateControl = 0 (slider from 0 to (rectangleWidth * rectangleHeight), step 1)
textUnitPlural = If(animateControl ≟ 1, "unit", "units")
numRandoms: 2
randIndex: (Mod[countQuestion, floor(Length[allRandomSeeds] / numRandoms)] * numRandoms) + 1
currentRandomSeeds = Take(allRandomSeeds, randIndex, randIndex + numRandoms - 1)
rectangleWidth: 1 + floor((currentRandomSeeds(1) * 10))
rectangleHeight: 5 + floor((currentRandomSeeds(2) * 6))
answer: (rectangleHeight * rectangleWidth)
textEquation: "\text{Area = length \times width} = " + (LaTeX[rectangleWidth]) + " \times " + (LaTeX[rectangleHeight]) + " = \textbf{" + (LaTeX[answer]) + "} \textsf{ square units}"
textCorrect: (("" * answer) * "")
unitPixels: abs(x(PointToPixels[(0, 0), Corner[1], Corner[3], Corner[5]] - PointToPixels[(1, 1), Corner[1], Corner[3], Corner[5]]))
randomNum1: 3 + floor((currentRandomSeeds(1) * 15))
onboarding = false
inputSaved: {NaN}
input2 = NaN
inputCurrent: {tempInput1}
B = (5.000341064524864, 5.69392166828734)
randomNum2: randomNum1 + 2 + floor((currentRandomSeeds(2) * 10))
validate = false
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
InputBox2 = Textfield(input2)
correct: tempInput1 ≟ (rectangleWidth * rectangleHeight)
showbuttons = true
typicalError1: 0
typicalError2: 0
helpTextHintTypicalError: "" + (LaTeX[If[inputSaved(1) ≟ (2 * (rectangleHeight + rectangleWidth)), "\textsf{You have calculated the perimeter of the figure instead of the area.}", "\textsf{Use the formula }\text{Area}=\text{length}\times \text{width}."]]) + ""
showhinttypicalerror = false
textCountCorrect: "\text{Number correct: " + (LaTeX[countCorrect]) + " }"
labelBtnValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
formatChecker = Zip(Defined[IndexOf[tt, textInput]], tt, {"+", "-", "*", "/", " ", "(", ")"})
correctFormat: ¬Defined[IndexOf[true, formatChecker]]
showwarning: (¬correctFormat) ∧ correct
enableBtnValidate: inputCurrent ≠ inputSaved ∧ inputCurrent ≟ RemoveUndefined[inputCurrent] ∧ (¬onboarding) ∧ (¬showwarning)
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16
pixelsTop: 24
textHint: "\textsf{\textcolor{" + (LaTeX[colorOrange]) + "}\bold{Hint}}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\"]]) + "\textsf{" + (LaTeX[If[showhint, helpTextHint]]) + "}"
layoutY: 72 + (unitPixels * rectangleHeight) + 24 - 4
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
layoutX: 250 + 16
layoutAppSize = Corner(5)
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correct}$", "$\text{✕ " + (If[tries < 3, "Try again", "Maybe next time"]) + "}$"]]) + ""
pulsingSpeed: 8
pulsing = 0.1 (slider from 0 to 1, step 0.1)
haloPixels: (pulsing * 7)
onboardingDisplayText: "" + (LaTeX[onboardingText]) + ""
A = (480, 71)
C = (4.917208433066277, 6.084005554362252)
layoutOnboarding = PointToPixels(Corner[onboardingDisplayText, 2], Corner[1], Corner[3], Corner[5])
onboardingX: 400
onboardingY: 148
onboardingCase: 2
OnboardingTextOffset = onboardingTextOffset(Corner[onboardingText, 1], Corner[onboardingText, 3], onboardingCase, Corner[1], Corner[3], Corner[5])
boxWidth: 1
boxHeight: 1
gridMaxY: (boxHeight * 10)
gridMaxX: (boxWidth * 10)
startRectangle = (-7.7566593211673345, 9.339427390547842)
isSquare: rectangleHeight ≟ rectangleWidth
typeText = If(isSquare, "square", "rectangle")
rectangleOutline = makeBox(startRectangle, rectangleWidth, rectangleHeight)
textQuestion: "\text{Find the area of the " + (LaTeX[typeText]) + ". } "
labelWidth = Text(rectangleWidth, startRectangle + (rectangleWidth / 2, 0), true, true, 0, 1)
labelHeight = Text(rectangleHeight, startRectangle + (0, ((-rectangleHeight)) / 2, 0), true, true, -1, 0)
boxPoints = Flatten(Sequence[Sequence[startRectangle - (0, (boxWidth * (rectangleHeight - 1))) + ((k * boxWidth), (j * boxWidth)), k, 0, rectangleWidth - 1], j, 0, rectangleHeight - 1])
boxes = Zip(makeBox[K, boxWidth, boxWidth], K, Take[boxPoints, 1, animateControl])
boxesOutline: boxes
textSolution: "\textsf{\bold{Solution}}\\" + (LaTeX[textEquation]) + ""
tabOrder: {textQuestion, InputBox1, btnValidate, textHint, textSolution, labelSlider, animateControl, btnNew}
rectangleFill: rectangleOutline
textCounter: "\textsf\textcolor{" + (LaTeX[colorBlack]) + "}{Area = }\textbf\textcolor{" + (LaTeX[colorPurpleButton]) + "}{" + (LaTeX[If[animateControl > 0, (("" * animateControl) * ""), "?"]]) + "} \textsf\textcolor{" + (LaTeX[colorBlack]) + "}{ square " + (LaTeX[textUnitPlural]) + "}"
pixelsSliderX: (unitPixels * rectangleWidth) + 58
pixelsSliderY: 72
isTypicalError: (¬correct) ∧ tries ≤ 2

Tool: PointToPixels
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: 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})