make sure at least one sector is colored, and one is not colored.

#3A6ED6

$\mathbf{⇓}$

#4D4D4D

$\text{NEW SPINNER}$

Fix position and allow selection for all text objects

Reset app

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#C75000

#E07415

#eeeeee

#2E006758

#2EB00020

\text{Experimental Probability}

\text{Theoretical Probability}

$\text{SPIN}$

\text{What is the probability the spinner will stop on purple?}

$\text{SPIN}$

allRandoms = RandomUniform(0, 0.99, 100)
allRandoms2 = RandomUniform(2, 6.999, 100)
randomStartAngle = Shuffle(Sequence[i + pi / 49, i, 0, (2 * pi), pi / 12])
randomColors = Shuffle(Sequence[100])
randomNumSectors = Zip(floor(A), A, allRandoms2)
results: {}
numTrials = Length(results)
countQuestion = 59
AnchorSpinner = (-7.0740600429220875, 0.4572675641488674)
totalSectors = Element(randomNumSectors, Mod[countQuestion, Length[randomNumSectors]] + 1)
PStart: AnchorSpinner + (3, 0)
sectorPoints = Sequence(Rotate[PStart, ((A * 2) * pi / totalSectors), AnchorSpinner], A, 1, totalSectors)
allSectors = Zip(CircleSector[AnchorSpinner, A, B], A, sectorPoints, B, Take[sectorPoints, 1])
currentColorIndex: Mod[countQuestion, Length[randomColors] - totalSectors] + 1
isColoredTmp = Sequence(IsInteger[randomColors(currentColorIndex + A) / 2], A, 0, Length[allSectors] - 1)
isColored = If(Sum[isColoredTmp] ≟ 0 ∨ Sum[¬isColoredTmp] ≟ 0, Append[¬(isColoredTmp(1)), Take[isColoredTmp, 2]], isColoredTmp)
spinnerIndex = 60
spinAngle = 4.45058959258554 (slider from 0 to (2 * pi), step pi / 12)
startAngle = Element(randomStartAngle, Mod[countQuestion, Length[randomStartAngle]] + 1)
animateControlSpeed = 15 (slider from minAnimate to maxAnimate, step 0.05)
randomSpeedFactors = Zip(3 + floor((A * 7)), A, allRandoms)
speedFactor: randomSpeedFactors(spinnerIndex)
speedFunc(x) = If[x < 14.1, (speedFactor * ((-atan(x)) + 1.5)), 0]
PointSizeLetter = (5.049986262284556, 1.321721941212304)
slideTheoretical = 1 (slider from 1 to 3, step 1)
showbuttons = true
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)}])
layoutY: 200
layoutX: 16
layoutAppSize = Corner(5)
inputSaved: {(0, 1)}
PointSizeNum = (5.06743307628411, 3.054705923611084)
sliderNum = 0
tableVals = Flatten({"\text{Landed on\\Purple}", Zip[If[n, "X", "O"], n, results]})
SpinnerCirc = Circle(AnchorSpinner, 3)
SpinEnd = Rotate(AnchorSpinner + (2.7, 0), startAngle + spinAngle, AnchorSpinner)
speed: 5
spinArrow = Segment(AnchorSpinner, SpinEnd)
sector6 = CircleSector(AnchorSpinner, sectorPoints(5), sectorPoints(6))
sector2 = CircleSector(AnchorSpinner, sectorPoints(1), sectorPoints(2))
sector3 = CircleSector(AnchorSpinner, sectorPoints(2), sectorPoints(3))
sector1 = CircleSector(AnchorSpinner, PStart, sectorPoints(1))
sector4 = CircleSector(AnchorSpinner, sectorPoints(3), sectorPoints(4))
sector5 = CircleSector(AnchorSpinner, sectorPoints(4), sectorPoints(5))
spinnerLocation = Zip(IsInRegion[SpinEnd, A], A, {sector1, sector2, sector3, sector4, sector5, sector6})
purpleRGB: {133 / 255, 117 / 255, 1}
coloredSectors = Sum(isColored)
theoreticalPercent: round((coloredSectors / totalSectors * 100))
step: 4 - slideTheoretical
experimentalPercent: round((Sum[results] / Length[results] * 100))
col1A = Append("Trial #", Sequence[("" * A), A, 1, Min[8, Length[results]]])
col1B = Append((("\cellcolor{" * colorPurpleLight) * "}"), Sequence[If[results(A), "✓", "X"], A, 1, Min[8, Length[results]]])
col3A = Append("Trial #", Sequence[("" * A), A, 17, Min[24, Length[results]]])
col2A = If(numTrials > 8, Append["Trial #", Sequence[("" * A), A, 9, Min[16, Length[results]]]], {""})
col2B = Append((("\cellcolor{" * colorPurpleLight) * "}"), Sequence[If[results(A), "✓", "X"], A, 9, Min[16, Length[results]]])
col3B = Append((("\cellcolor{" * colorPurpleLight) * "}"), Sequence[If[results(A), "✓", "X"], A, 17, Min[24, Length[results]]])
maxTrials: 24
experimentalData1 = TableText(col1A, col1B, "|_vc")
experimentalData2 = TableText(col2A, col2B, "|_vc")
experimentalData3 = TableText(col3A, col3B, "|_vc")
equalitySign = If(experimentalPercent ≟ (Sum[results] / Length[results] * 100), "=", "\approx")
equalityTheoretical = If(theoreticalPercent ≟ (coloredSectors / totalSectors * 100), "=", "\approx")
minAnimate: -20 - floor((Element[allRandoms, Mod[countQuestion + numTrials, Length[allRandoms]] + 1] * 25))
maxAnimate: 15
textStart: "\text{\begin{align}\textsf{P}(\textcolor{" + (LaTeX[colorPurpleDark]) + "}\textsf{Purple}) &= \dfrac{\textsf{number of purple sections}}{\textsf{total number of sections}}\\" + (LaTeX[If[step > 1, (((("\\&= \(\dfrac{ " * coloredSectors) * "}{") * totalSectors) * "}\)"), ""]]) + "" + (LaTeX[If[step > 2, (((("\\&" * equalityTheoretical) * " \vphantom{\frac{1}{2}}") * theoreticalPercent) * "\%"), ""]]) + "
\end{align}}"
textExperimental: "\text{\begin{align}
\textsf{P}(\textcolor{" + (LaTeX[colorPurpleDark]) + "}\textsf{Purple}) &= \dfrac{\textsf{number of successes}}{\textsf{number of trials}}\\" + (LaTeX[If[Length[results] > 0, (((("&= \(\dfrac{" * Sum[results]) * "}{") * Length[results]) * "}\)"), ""]]) + "" + (LaTeX[If[Length[results] > 0, (((("\\&" * equalitySign) * " \vphantom{\dfrac{1}{2}}") * experimentalPercent) * "\%"), ""]]) + "\end{align}}"
spinning = true
settingUp = false

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)