ensure you include a 3 and 4 digit number where the thousands digit of thr 4 digit number is less than the hunderds digit of the 3 digit number

#006758

#252525

#C75000

#4D4D4D

$\text{Check}$

$\text{NUEVO}$

Fix position and allow selection for all text objects

Empty all input boxes

Reset app

#B00020

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#E07415

#eeeeee

#2E006758

#2EB00020

\text{Arrastra a las cajas

send all of the control points to their home locations

\text{Ten en cuenta el valor posicional de cada cifra\al comparar los números.}

fix any boxes that are in the correct positions - called from btnValidate

allRandomSeeds = RandomUniform(0, 0.99, 200)
savedPositions: {false, false, false, false, false}
Anchor: (-17.8, 11)
boxWidth: 4
boxAnchors = Sequence(Anchor + (((A * 1.5) * boxWidth), 0), A, 0, 4)
boxHeight: 2.5
frame5 = centerBox((1.1 * boxWidth), (1.1 * boxHeight), boxAnchors(5))
frame2 = centerBox((1.1 * boxWidth), (1.1 * boxHeight), boxAnchors(2))
frame1 = centerBox((1.1 * boxWidth), (1.1 * boxHeight), boxAnchors(1))
frame3 = centerBox((1.1 * boxWidth), (1.1 * boxHeight), boxAnchors(3))
frame4 = centerBox((1.1 * boxWidth), (1.1 * boxHeight), boxAnchors(4))
movingIndex = NaN
P1 = (-18, 16)
P2 = (-13.2, 16)
P3 = (-8.4, 16)
P4 = (-3.6000000000000014, 16)
P5 = (1.1999999999999993, 16)
movingPoints: {P1, P2, P3, P4, P5}
PMove = Element(movingPoints, movingIndex)
currentLocations: {-1, -1, -1, -1, -1}
specialOptions: {{316, 2418}, {481, 1423}, {634, 5192}, {713, 2973}, {642, 5426}, {819, 7632}}
numRandoms: 15
countQuestion = 0
randIndex: (Mod[countQuestion, floor(Length[allRandomSeeds] / numRandoms)] * numRandoms) + 1
currentRandomSeeds = Take(allRandomSeeds, randIndex, randIndex + numRandoms - 1)
specialCurrent = Element(specialOptions, 1 + floor((currentRandomSeeds(6) * Length[specialOptions])))
isIncreasing: currentRandomSeeds(6) > 0.5
numberOptions = Unique(Zip[round((A * 10000)), A, Take[currentRandomSeeds, 1, 15]])
possibleNumbers = RemoveUndefined(Zip[If[A > 100 ∧ A ≠ specialOptions(1) ∧ A ≠ specialOptions(2), A], A, numberOptions])
numA = Element(possibleNumbers, 1 + floor((currentRandomSeeds(7) * Length[possibleNumbers])))
numB = Element(Remove[possibleNumbers, {numA}], 1 + floor((currentRandomSeeds(8) * (Length[possibleNumbers] - 1))))
numC = Element(Remove[possibleNumbers, {numA, numB}], 1 + floor((currentRandomSeeds(9) * (Length[possibleNumbers] - 2))))
allNumbers = Join({{numA, numB, numC}, specialCurrent})
index1: 1 + floor((currentRandomSeeds(1) * 5))
num1: allNumbers(index1)
index2 = Element(Remove[{1, 2, 3, 4, 5}, {index1}], 1 + floor((currentRandomSeeds(2) * 4)))
num2: allNumbers(index2)
index3 = Element(Remove[{1, 2, 3, 4, 5}, {index1, index2}], 1 + floor((currentRandomSeeds(2) * 3)))
num3: allNumbers(index3)
index4 = Element(Remove[{1, 2, 3, 4, 5}, {index1, index2, index3}], 1 + floor((currentRandomSeeds(2) * 2)))
num4: allNumbers(index4)
index5 = Element(Remove[{1, 2, 3, 4, 5}, {index1, index2, index3, index4}], 1)
num5: allNumbers(index5)
sortedOrder = Sort({num1, num2, num3, num4, num5})
expectedIncreasingOrder = Zip(IndexOf[A, sortedOrder], A, {num1, num2, num3, num4, num5})
expectedDecreasingOrder = Zip(IndexOf[A, Reverse[sortedOrder]], A, {num1, num2, num3, num4, num5})
expectedOrder = If(isIncreasing, expectedIncreasingOrder, expectedDecreasingOrder)
correctPosition = Sequence(IndexOf[A, currentLocations] ≟ IndexOf[A, expectedOrder], A, 1, 5)
numBoxes: 5
sortedNumbers = Sort({num1, num2, num3, num4, num5})
inputCurrent: {currentLocations}
highlightColor: colorTealSuccess
validate = false
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
correct: expectedOrder ≟ currentLocations
showbuttons = true
showhinttypicalerror = false
textCountCorrect: "\text{Correctos: " + (LaTeX[countCorrect]) + " }"
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
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
layoutX: 16
layoutAppSize = Corner(5)
inputSaved: {{-1, -1, -1, -1, -1}}
organizing = false
HomeAnchor: (-18, 16)
homePoints = Sequence(HomeAnchor + (((A * 1.2) * boxWidth), 0), A, 0, 4)
box1 = centerBox(boxWidth, boxHeight, P1)
box2 = centerBox(boxWidth, boxHeight, P2)
box3 = centerBox(boxWidth, boxHeight, P3)
box4 = centerBox(boxWidth, boxHeight, P4)
highlightBox = centerBox(boxWidth, boxHeight, PMove)
HOME: -1
allHome = Zip(HOME, A, movingPoints)
tmpIndex = NaN
NOANSWER: -1
enableBtnValidate: inputCurrent ≠ inputSaved ∧ (¬Defined[IndexOf[HOME, currentLocations]])
locationPMove = IndexOf(true, Zip[IsInRegion[PMove, A] ∧ (¬B), A, {frame1, frame2, frame3, frame4, frame5}, B, savedPositions])
count: 1
onboarding = true
pulsingSpeed: 8
pulsing = 0.1 (slider from 0 to 1, step 0.1)
onboardingX = 400
onboardingY = 80
onboardingCase: 1
OnboardingTextOffset = onboardingTextOffset(Corner[onboardingText, 1], Corner[onboardingText, 3], onboardingCase, Corner[1], Corner[3], Corner[5])
onboardingDisplayText: "" + (LaTeX[onboardingText]) + ""
PTemp = (0.1999999999999993, 11)
highlightFrame = centerBox(boxWidth, boxHeight, boxAnchors(locationPMove))
displayText: {("" * num1), ("" * num2), ("" * num3), ("" * num4), ("" * num5)}
boxText = Zip(Text[("\vphantom{\dfrac{1}{2}}" * A), B, true, true, 0, 0], A, displayText, B, movingPoints)
textHighlight = If(Defined[movingIndex], Text[(("\text{" * displayText(movingIndex)) * "}"), PMove, true, true, 0, 0], "")
blockWidth: 80
box5 = centerBox(boxWidth, boxHeight, P5)
homeLocations: homePoints
cmdSendHome = Sequence((((("SetValue(P" * A) * ",homeLocations(") * A) * "))"), A, 1, numBoxes)
cmdFixBoxes = Sequence((("SetFixed(box" * A) * ",false,enableInput)"), A, 1, numBoxes)
textQuestion: "\textsf{Coloca los números en orden " + (LaTeX[If[isIncreasing, "creciente", "decreciente"]]) + " de izquierda a derecha.}"
pulsingBox = expandQuad(Vertex[box5, 1], Vertex[box5, 2], Vertex[box5, 3], Vertex[box5, 4], (7 * pulsing), Corner[1], Corner[3], Corner[5])
tabOrder: {textQuestion, box1, box2, box3, box4, box5, btnValidate, textCountCorrect, btnNew}
isTypicalError: currentLocations ≟ If[isIncreasing, expectedDecreasingOrder, expectedIncreasingOrder]
helpTextHintTypicalError: "\text{Recuerda colocar los números en orden " + (LaTeX[If[isIncreasing, "creciente", "decreciente"]]) + ". }"
cmdFixCorrect = Zip((((((("SetFixed(box" * C) * ",") * If[A ≟ B, "true", "false"]) * ",") * If[A ≟ B, "false", "true"]) * ")"), A, currentLocations, B, expectedOrder, C, {1, 2, 3, 4, 5})
lockedFrames: {true, false, false, false, true}
individualFeedback = Zip(Text[If[A, (("\textcolor{" * colorTealSuccess) * "}{✓}"), If[validate, (("\textcolor{" * colorRedError) * "}{✕} "), ""]], B + (0, 2.5), true, true, 0, 0], A, savedPositions, B, boxAnchors)
labelBtnValidate: "\text{CHEQUEAR (" + (LaTeX[3 - tries]) + ")}"
textHint: "\text{\color{" + (LaTeX[colorOrange]) + "}\bold{Pista}}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\", ""]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + ""
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correcto}$", "$\text{✕ " + (If[tries < 3, "Reinténtalo", "Quizás la próxima vez"]) + "}$"]]) + ""
textSolution: "\text{\bold{Solución}\\Los números " + (LaTeX[ReplaceAll[("" * If[isIncreasing, sortedOrder, Reverse[sortedOrder]]), "}", ""]]) + " están en orden " + (LaTeX[If[isIncreasing, "creciente", "decreciente"]]) + ".}"

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)

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: 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: expandQuad
expandQuad(A,B,C,D,pixelGap,Corner1,Corner3,Corner5)
Input: A, B, C, D, pixelGap, Corner1, Corner3, Corner5
Output: newPolygon

Corner5: (800, 500)
Corner3: (7, 6)
Corner1: (-4, -2)
distanceY: (pixelGap / y(Corner5) * (y(Corner3) - y(Corner1)))
distanceX: (pixelGap / x(Corner5) * (x(Corner3) - x(Corner1)))
pointGap: distanceX
allVerts: {A, B, C, D}
concaveAngles = Zip(Angle[I, J, K] > 180°, I, Append[allVerts(-1), allVerts], J, allVerts, K, Append[Take[allVerts, 2], allVerts(1)])
allVecs = Zip(Vector[J, K], J, allVerts, K, Append[Take[allVerts, 2], allVerts(1)])
pVecs = Zip(Vector[UnitOrthogonalVector[A]], Vector[A], allVecs)
xyScale: (distanceY) / (distanceX)
circTemplate = CurveCartesian((pointGap * cos(t)), ((xyScale * pointGap) * sin(t)), t, 0, (2 * pi))
scaledVecs = Zip(Vector[(x(K), (xyScale * y(K)))], Vector[K], pVecs)
vPointsPre = Zip(A - (pointGap * B), A, allVerts, B, Append[scaledVecs(-1), scaledVecs])
vPointsPost = Zip(A - (pointGap * B), A, allVerts, Vector[B], scaledVecs)
endAngles = Zip(Angle[M + (1, 0), M, K], K, vPointsPost, M, allVerts)
startAngles = Zip(Angle[M + (1, 0), M, K], K, vPointsPre, J, vPointsPost, M, allVerts)
roundedCornersConvex = Zip(Sequence[circTemplate(K) + A, K, B, C + If[B > C, (2 * pi), 0], (C + If[B > C, (2 * pi), 0] - B) / 4], A, allVerts, B, endAngles, C, startAngles)
roundedCornersConcave = Zip(Sequence[circTemplate(K) + A, K, B, C + If[B > C, (2 * pi), 0], (C + If[B > C, (2 * pi), 0] - B) / 4], A, allVerts, B, startAngles, C, endAngles)
cornerAngles = Zip(Angle[A, B, C], A, vPointsPre, B, allVerts, C, vPointsPost)
cornerPoints = Flatten(Zip[If[¬Concave, {Element[D, 3]}, If[A < pi / 3 ∨ (¬Concave), {Element[C, 3]}, C]], A, cornerAngles, C, roundedCornersConcave, D, roundedCornersConvex, Concave, concaveAngles])
newPolygon = Polygon(cornerPoints)

Tool: makeBox
makeBox(point,width,height)
Input: A, width, height
Output: myBox

A: (0, 0)
height: 3
width: 2
myBox = Polygon({A, A + (width, 0), A + (width, height), A + (0, height)})