1 + floor(currentRandomSeeds(3) * 3)

(boxHeightLeft - boxHeightRight) / 2

#4D4D4D

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

\text{Drag to change denominator}

\text{ Drag to change numerator }

allRandomSeeds = RandomUniform(0, 0.99, 200)
onboarding2 = true
onboarding1 = true
currentNumer = 6
numPieces: 12
validDenoms = Zip(currentNumer / A ≤ 4, A, {2, 3, 4, 5, 6})
currentDenom = 3
currentScale = 6
rightDenom: (currentDenom * currentScale)
MoveAnchor = (2.6347371179525827, 24.090484219766005)
caseNum = 1
AnchorLeft: MoveAnchor + Element[{(-5, 0), (1, -3), (-3, 0)}, caseNum]
AnchorRight: AnchorLeft + (Element[{29, 27.5, 27}, caseNum], 0)
modelWidth = 20
boxWidthLeft = If(caseNum ≟ 1, modelWidth / currentDenom, 4)
boxHeightLeft = If(caseNum ≟ 1, 4, modelWidth / currentDenom)
boxAnchorsLeftCase1 = Flatten(Sequence[Sequence[AnchorLeft + ((boxWidthLeft * i), ((-1.2 * boxHeightLeft) * j)), i, 0, currentDenom - 1], j, 0, 3])
boxHeightRight = If(caseNum ≟ 1, 4, modelWidth / rightDenom)
circAnchorsLeft = Flatten(Sequence[Sequence[AnchorLeft + ((modelWidth / 2 * i), (((-modelWidth)) / 2 * j)), i, 0, 1], j, 0, 1])
circAnchorsRight = Translate(circAnchorsLeft, AnchorRight - AnchorLeft)
sectorPointsRight = Zip(Sequence[Rotate[A + ((0.24 * modelWidth), 0), K, A], K, 0, (2 * pi), (2 * pi / rightDenom)], A, circAnchorsRight)
pieceSizeLeft = Element({modelWidth / currentDenom, 0, modelWidth / currentDenom}, caseNum)
boxWidthRight = If(caseNum ≟ 1, modelWidth / rightDenom, 4)
boxAnchorsRightCase1 = Flatten(Sequence[Sequence[AnchorRight + ((boxWidthRight * i), ((-1.2 * boxHeightRight) * j)), i, 0, rightDenom - 1], j, 0, 3])
SlideStartRight = Element({(x(AnchorRight), y(boxAnchorsLeftCase1(-1) - boxHeightRight)), sectorPointsRight(1, 1), AnchorRight}, caseNum)
unitLocations = Sequence(A, A, 0, 45, 45 / 4)
smallNumerLocations = Unique(Remove[Flatten[Zip[Sequence[(A + B, 0), B, 0, unitLocations(2), unitLocations(2) / currentDenom], A, Take[unitLocations, 1, Length[unitLocations] - 1]]], {(0, 0)}])
tickLocations = Flatten(Zip[Sequence[(A + B, 0), B, 0, unitLocations(2), unitLocations(2) / rightDenom], A, Take[unitLocations, 1, Length[unitLocations] - 1]])
PEnd = Point(smallNumerLocations)
numRandoms: 3
countQuestion = 0
randIndex: (Mod[countQuestion, floor(Length[allRandomSeeds] / numRandoms)] * numRandoms) + 1
currentRandomSeeds = Take(allRandomSeeds, randIndex, randIndex + numRandoms - 1)
case3Offset: 0
studentAns = NaN
validate = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
showbuttons = true
showhinttypicalerror = false
labelBtnValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16
pixelsTop: 24
layoutY: 71
layoutX: 250
layoutAppSize = Corner(5)
BoxAnchor: AnchorLeft + (-1, 1)
layoutXHint: 11
layotuX: 230
minDenom: IndexOf[true, validDenoms] + 1
layoutButtonsX: 290
startDenom: 3 + floor((currentRandomSeeds(1) * 6))
startNumer: 1 + floor((currentRandomSeeds(2) * (startDenom - 1)))
showanswer = false
boxAnchorsRightCase3 = Flatten(Sequence[Sequence[AnchorRight + (((1.2 * boxWidthRight) * i), case3Offset - (boxHeightRight * j)), j, 0, rightDenom - 1], i, 0, 3])
boxAnchorsRight = If(caseNum ≟ 1, boxAnchorsRightCase1, boxAnchorsRightCase3)
sectorPointsLeft = Zip(Sequence[Rotate[A + ((0.24 * modelWidth), 0), K, A], K, 0, (2 * pi), (2 * pi / currentDenom)], A, circAnchorsLeft)
sectorsLeft = Zip(Sequence[CircleSector[A, Element[B, K], Element[B, K + 1]], K, 1, Length[B] - 1], A, circAnchorsLeft, B, sectorPointsLeft)
filledSectorsLeft = Take(Unique[Flatten[sectorsLeft]], 1, currentNumer)
filledSectorsRight = Translate(filledSectorsLeft, AnchorRight - AnchorLeft)
numberLine = Segment((-2, 0), (47, 0))
numbers = Zip(Text[("" * A), (B, -0.5), true, true, 0, -1], A, Sequence[("" * A), A, 0, Length[unitLocations]], B, unitLocations)
smallTicks = Zip(Sequence[Segment[(A + B, 0), (A + B, -0.5)], B, 0, unitLocations(2), unitLocations(2) / rightDenom], A, Take[unitLocations, 1, Length[unitLocations] - 1])
bigTicks = Zip(Segment[(A, 1), (A, -1)], A, unitLocations)
mediumTicks = Zip(Sequence[Segment[(A + B, 0.75), (A + B, 0)], B, 0, unitLocations(2), unitLocations(2) / currentDenom], A, Take[unitLocations, 1, Length[unitLocations] - 1])
laoutButtonsX: 290
slideP: 1
fractionSegment = Segment((0, 0), PEnd)
numerRight: (currentNumer * currentScale)
SlideStartLeft = Element({(x(AnchorLeft), y(boxAnchorsLeftCase1(-1) - boxHeightRight)), sectorPointsLeft(1, 1), AnchorLeft}, caseNum)
SlideEndRight = Element({SlideStartRight + (pieceSizeLeft / 2, 0), Rotate[SlideStartRight, pi / currentDenom, AnchorRight], SlideStartRight + (0, ((-pieceSizeLeft)) / 2)}, caseNum)
SlideEndLeft = Element({SlideStartLeft + (modelWidth / 2, 0), Rotate[SlideStartLeft, pi, AnchorLeft], SlideStartLeft + (0, ((-modelWidth)) / 2)}, caseNum)
denPointsRight = Sequence(Element[{SlideStartRight + ((2 / A * (x(SlideEndRight) - x(SlideStartRight))), 0), Rotate[SlideStartRight, (2 * Angle[SlideStartRight, AnchorRight, SlideEndRight] / A), AnchorRight], SlideStartRight + (0, (2 / A * (y(SlideEndRight) - y(SlideStartRight))))}, caseNum], A, 6, 2, -1)
PMoveRight = Point(denPointsRight)
testRight: 6 - IndexOf[PMoveRight, denPointsRight]
displayFrac: "\dfrac{\textcolor{" + (LaTeX[colorPink]) + "}{" + (LaTeX[currentNumer]) + "}}{\textcolor{" + (LaTeX[colorPurpleButton]) + "}{" + (LaTeX[currentDenom]) + "}}=\dfrac{\textcolor{" + (LaTeX[colorPink]) + "}{" + (LaTeX[numerRight]) + "}}{\textcolor{" + (LaTeX[colorTealSuccess]) + "}{" + (LaTeX[rightDenom]) + "}}"
denPointsLeft = Sequence(Element[{SlideStartLeft + ((1 / A * modelWidth), 0), Rotate[SlideStartLeft, (2 * pi / A), AnchorLeft], SlideStartLeft + (0, (-1 / A * modelWidth))}, caseNum], A, 6, minDenom, -1)
PMoveLeft = Point(denPointsLeft)
boxesRight = Zip(topBox[boxHeightRight, boxWidthRight, A], A, boxAnchorsRight)
boxAnchorsLeftCase3 = Flatten(Sequence[Sequence[AnchorLeft + (((1.2 * boxWidthLeft) * i), ((-boxHeightLeft) * j)), j, 0, currentDenom - 1], i, 0, 3])
boxAnchorsLeft = If(caseNum ≟ 1, boxAnchorsLeftCase1, boxAnchorsLeftCase3)
boxesLeft = Zip(topBox[boxHeightLeft, boxWidthLeft, A], A, boxAnchorsLeft)
filledLeft = Take(boxesLeft, 1, currentNumer)
filledRight = Translate(filledLeft, AnchorRight - AnchorLeft)
sectorsRight = Zip(Sequence[CircleSector[A, Element[B, K], Element[B, K + 1]], K, 1, Length[B] - 1], A, circAnchorsRight, B, sectorPointsRight)
moveDenomLeft: 7 - IndexOf[PMoveLeft, denPointsLeft]
moveScaleRight: 7 - IndexOf[PMoveRight, denPointsRight]
fracDisplayList: {}
fracDisplayLeft: "\dfrac{\textcolor{ " + (LaTeX[colorPink]) + "}{" + (LaTeX[currentNumer]) + " }}{\textcolor{" + (LaTeX[colorPurpleButton]) + "}{" + (LaTeX[currentDenom]) + " }}"
fracDisplayRight: (((((((("\dfrac{\textcolor{" * colorPink) * "}{") * numerRight) * "}}{\textcolor{") * colorTealSuccess) * "}{ ") * rightDenom) * "}}")
fracDisplay = TableText({((fracDisplayLeft * "=") * fracDisplayRight)}, "c", 200, 5)
numPiecess: 9
movingNumer = IndexOf(PEnd, Unique[smallNumerLocations])
slideSegmentLeft = Segment(denPointsLeft(1), denPointsLeft(-1))
slideArcLeft = CircleArc(AnchorLeft, denPointsLeft(1), denPointsLeft(-1))
slideArcRight = CircleArc(AnchorRight, denPointsRight(1), denPointsRight(-1))
slideSegmentRight = Segment(denPointsRight(1), denPointsRight(-1))
onboarding: onboarding1 ∨ onboarding2
pulsingSpeed: 8
pulsing = 0.8 (slider from 0 to 1)
onboardingCase: 4
OnboardingOffset = onboardingTextOffset(Corner[onboardingText1, 1], Corner[onboardingText1, 3], onboardingCase, Corner[1], Corner[3], Corner[5])
onboardingX: {165, 476}
onboardingY = 390
pulsingObject1 = circlePixels(PMoveLeft, 7 + (7 * pulsing), Corner[1], Corner[3], Corner[5])
pulsingObject2 = circlePixels(PEnd, 7 + (7 * pulsing), Corner[1], Corner[3], Corner[5])
onboardingDisplayText1: "" + (LaTeX[onboardingText1]) + ""

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)

Tool: centerBox
(width,height,CenterPoint)
Input: width, length, StartPoint
Output: myBox

StartPoint: (0, 0)
A: StartPoint + (((-width)) / 2, ((-length)) / 2)
D: A + (0, length)
B: A + (width, 0)
C: A + (width, length)
myBox = Polygon({A, B, C, D})

Tool: topBox
topBox(length,width,TopLeftCorner)
Input: length, width, A
Output: newBox

A: (0, 0)
length: 1
width: 2
B: A + (width, 0)
C: A + (width, (-length))
D: A + (0, (-length))
newBox = Polygon({D, C, B, A})

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: circlePixels
circlePixels(A,pixelRadius,Corner1,Corner3,Corner5
Input: A, pixelRadius, Corner1, Corner3, Corner5
Output: newCircle

pointRadius: (pixelRadius / x(Corner5) * (x(Corner3) - x(Corner1)))
newCircle = Circle(A, pointRadius)