baja

#4D4D4D

$\text{Check}$

$\text{NUEVO PATRÓN}$

Fix position and allow selection for all text objects

Empty all input boxes

$b=$

Reset app

#006758

#B00020

#252525

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#C75000

#E07415

\text{Arrastra el punto para explorar la recta numérica.}

#eeeeee

#2E006758

#2EB00020

\text{Drag to start}

\text{Continúa el patrón y completa el siguiente número de la secuencia. } 

allRandomSeeds = RandomUniform(0, 0.99, 200)
tempInput1 = NaN
animateSolution = 0 (slider from 0 to 1, step 0.005)
countQuestion = 0
lineStart: (0, 0)
lineEnd: (7.21557, y(lineStart))
numRandoms: 4
randIndex: (Mod[countQuestion, floor(Length[allRandomSeeds] / numRandoms)] * numRandoms) + 1
currentRandomSeeds = Take(allRandomSeeds, randIndex, randIndex + numRandoms - 1)
numShown: 3 + floor((currentRandomSeeds(4) * 3))
animateSolutionIndex: floor((animateSolution * numShown)) + 1
solutionLabelIndex = Min({animateSolutionIndex, numShown})
numInc: 1 + floor((currentRandomSeeds(3) * 15))
isAddition: currentRandomSeeds(1) > 0.5
numSign = If(isAddition, 1, -1)
numStart: If[isAddition, 1, 100] + floor((currentRandomSeeds(1) * If[isAddition, 100, 200]))
numSequence = Sequence(numStart + ((numSign * numInc) * k), k, 0, 7)
numsUsed = Sequence(numSequence(k), k, 1, numShown + 1)
maxNum: Max[numsUsed] + numInc
minNum: Min[numsUsed] - numInc
numberLineStart: minNum
unitLength: (x(lineEnd) - x(lineStart)) / (maxNum - minNum)
hopStart: (((numStart - numberLineStart) * unitLength), y(lineStart)) + lineStart
hopLength: (unitLength * numInc)
hopPoints = Sequence(hopStart + (((k * numSign) * hopLength), 0), k, 0, numShown)
lineLength: x(lineEnd) - x(lineStart)
numTicks: 15
numberLineSpacing: lineLength / numTicks
spacing: ((numShown + 2) * numInc / numTicks)
realSpacing: ceil(spacing)
studentInput: 0
numCorrect: numSequence(numShown + 1)
tickHeight: 0.05
textNumbers4: "\text{" + (LaTeX[numSequence(1)]) + ", " + (LaTeX[numSequence(2)]) + ", " + (LaTeX[numSequence(3)]) + ", " + (LaTeX[numSequence(4)]) + ",}"
textNumbers5: "\text{" + (LaTeX[numSequence(1)]) + ", " + (LaTeX[numSequence(2)]) + ", " + (LaTeX[numSequence(3)]) + ", " + (LaTeX[numSequence(4)]) + ", " + (LaTeX[numSequence(5)]) + ",}"
textNumbers3: "$\text{" + (LaTeX[numSequence(1)]) + ", " + (LaTeX[numSequence(2)]) + ", " + (LaTeX[numSequence(3)]) + ",}$"
textNumbers = Element({textNumbers3, textNumbers4, textNumbers5}, numShown - 2)
randomNum1: 1 + floor((currentRandomSeeds(1) * 20))
onboarding = false
inputSaved: {NaN}
input2 = NaN
input1 = NaN
PMoveA = (3.4347091871177713, 5.572495645015256)
inputCurrent: {tempInput1}
randomNum2: randomNum1 + 2 + floor((currentRandomSeeds(2) * 10))
correct1: input1 ≟ randomNum1
validate = false
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
InputBox1 = Textfield(input1)
InputBox2 = Textfield(input2)
correct2: input2 ≟ randomNum2
correct: input1 ≟ numCorrect
showbuttons = true
typicalError1: 0
typicalError2: 0
helpTextHintTypicalError: "\text{Tu respuesta es demasiado " + (LaTeX[errorType]) + ". Intenta de nuevo.}"
showhinttypicalerror = false
pixelsRight: 16
pixelsLeft: 16
pixelsBottom: 16
pixelsTop: 24
layoutY: 92 + 16
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
layoutX: 16
layoutAppSize = Corner(5)
enableBtnValidate: inputCurrent ≠ inputSaved ∧ inputCurrent ≟ RemoveUndefined[inputCurrent] ∧ (¬onboarding)
PMoveB = (4.1638207264560645, 6.136241785204535)
displaySegment = Segment(PMoveA, PMoveB)
StartA = (3.4347091871177713, 5.572495645015256)
StartB = (4.1638207264560645, 6.136241785204535)
pulsingSpeed: 8
pulsing = 0.5 (slider from 0 to 1, step 0.1)
haloPixels: (pulsing * 7)
count = 2
pulsingObject = expandSegment(PMoveA, PMoveB, (pulsing * 7), Corner[1], Corner[3], Corner[5])
onboardingCase: 1
onboardingX: 337
onboardingY: 150
OnboardingTextOffset = onboardingTextOffset(Corner[onboardingText, 1], Corner[onboardingText, 3], onboardingCase, Corner[1], Corner[3], Corner[5])
onboardingDisplayText: "" + (LaTeX[onboardingText]) + ""
textSign = If(isAddition, "\text{ + }", "\text{ - }")
textNumbersSize: PointToPixels[Corner[1], Corner[3], Corner[5], Corner[textNumbers, 1]] - PointToPixels[Corner[1], Corner[3], Corner[5], Corner[textNumbers, 3]]
textNumbersLength: abs(x(textNumbersSize))
labelNums = Take(numsUsed, 1, numShown)
labelLocations = Take(hopPoints, 1, numShown)
finalPoint: hopPoints(Length[hopPoints] - 1)
linePoints = Sequence(lineStart + ((k * unitLength), 0), k, 0, maxNum - minNum)
studentPoint = Point(linePoints)
funcStart = If(isAddition, x(hopStart), x(hopStart) - (hopLength * (numShown - 1)))
funcEnd = If(isAddition, x(hopStart + (hopLength * (numShown - 1))), x(hopStart))
studentStart = Min({x(studentPoint), x(finalPoint)})
studentEnd = Max({x(studentPoint), x(finalPoint)})
hopCurve(x) = If[funcStart < x < funcEnd, (0.3 * abs(sin((pi / hopLength * (x - funcStart)))))]
studentCurve(x) = If[studentStart < x < studentEnd, abs((0.3 * sin((pi / abs(x(finalPoint) - x(studentPoint)) * (x - studentStart)))))]
numberLine = Segment(lineStart - (0.2, 0), lineEnd + (0.2, 0))
ticks = Sequence(Segment[lineStart + ((k * unitLength), tickHeight), lineStart + ((k * unitLength), (-tickHeight))], k, 0, maxNum - minNum)
before10: 10 - Mod[minNum, 10]
tooHigh: input1 > numCorrect
tooLow: input1 < numCorrect
isTypicalError: tooHigh ∨ tooLow
studentPointValue: x(studentPoint) / unitLength + minNum
labels = Zip(Text[(("" * A) * ""), B, true, true, 0, -1], A, labelNums, B, Zip[k - (0, 0.1), k, labelLocations])
studentPointLabel = Text((("" * studentPointValue) * ""), studentPoint - (0, 0.1), true, true, 0, -1)
studentLocation: ((input1 - minNum) * unitLength)
solutionStart: x(hopStart)
solutionEnd: x(hopStart) + ((numSign * hopLength) * numShown)
solutionInequality = If(solutionStart > solutionEnd, solutionStart ≥ x ≥ solutionStart - (animateSolution * (solutionStart - solutionEnd)), solutionStart ≤ x ≤ solutionStart + (animateSolution * (solutionEnd - solutionStart)))
solutionCurve(x) = If[solutionInequality(x), (0.3 * abs(sin((pi / hopLength * (x - solutionStart)))))]
solutionLabels = Zip(Text[(("" * A) * ""), B, true, true, 0, -1], A, Take[numsUsed, 1, solutionLabelIndex], B, Zip[k - (0, 0.1), k, Take[hopPoints, 1, solutionLabelIndex]])
startTopPoint: hopStart + ((numSign * hopLength / 2), 0.3)
topPoints = Sequence(startTopPoint + (numSign * ((hopLength * k), 0)), k, 0, numShown - 1)
topLabel: "" + textSign + "" + numInc + ""
SolutionPoint: hopPoints(numShown + 1)
solutionLabel = Text((("" * numCorrect) * ""), SolutionPoint - (0, 0.1), true, true, 0, -1)
animateHopIndex: round((animateSolution * numShown))
topLabels = Zip(Text[(("" * topLabel) * ""), B, true, true, 0, 1], B, Take[topPoints, 1, animateHopIndex])
ticksLarge = Sequence(Segment[lineStart + ((before10 * unitLength) + ((k * 10) * unitLength), (2 * tickHeight)), lineStart + ((before10 * unitLength) + ((k * 10) * unitLength), (-2 * tickHeight))], k, 0, floor((maxNum - minNum) / 10) - 1)
played = false
animateSpeed: 5
labelTicks = Zip(Segment[A + (0, (tickHeight * 1.5)), A - (0, (tickHeight * 1.5))], A, labelLocations)
showNumberLine = false
labelBtnValidate: "\text{CHEQUEAR (" + (LaTeX[3 - tries]) + ")}"
textCountCorrect: "\text{Correctos: " + (LaTeX[countCorrect]) + " }"
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correcto}$", "$\text{✕ " + (If[tries < 3, "Reinténtalo", "Quizás la próxima vez"]) + "}$"]]) + ""
textHint: "\text{\color{" + (LaTeX[colorOrange]) + "}\bold{Pista}\\" + (LaTeX[If[showhinttypicalerror ∧ (¬showhint), helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, ""]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + "}"
textSolution: "\text{\bold{Solución}\\
El siguiente número de la secuencia es el " + (LaTeX[numCorrect]) + ".}"

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: expandSegment
expandSegment(A,B,pixelGap,Corner1,Corner3,Corner5)
Input: A, B, pixelGap, Corner1, Corner3, Corner5
Output: newPoly

distanceX: (pixelGap / x(Corner5) * (x(Corner3) - x(Corner1)))
distanceY: (pixelGap / y(Corner5) * (y(Corner3) - y(Corner1)))
pointGap: distanceX
xyScale: distanceY / distanceX
A: (0, 0)
vecAB: B - A
pVec: (20 * UnitVector[(((-y(vecAB))) / xyScale, (x(vecAB) * xyScale))])
pVecAngle = Angle(xAxis, Line[(0, 0), pVec])
realAngle = If(pVecAngle ≟ pi / 2 ∨ pVecAngle ≟ (3 * pi / 2), pVecAngle, atand(tan(pVecAngle) / xyScale))
curveFunction = CurveCartesian((pointGap * cos(u)), ((pointGap * xyScale) * sin(u)), u, 0, (2 * pi))
K: curveFunction(realAngle)
vSpace = Vector(K)
allPoints: {A + vSpace, A - vSpace, B - vSpace, B + vSpace}
newPoly = Polygon(allPoints)

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: 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)