#006758

#252525

#C75000

#4D4D4D

$\text{Check}$

$\text{NEW PROBLEM}$

Fix position and allow selection for all text objects

Empty all input boxes

Reset app

\text{This is the error specific hint}

#B00020

#757575

#949494

#E44461

#DA2570

#E66B9E

#3A6ED6

#5991FF

#008475

#0F8538

#00a83c

#5145A8

#6557D2

#8575FF

#903D14

#BD6C43

#E07415

\text{Be sure the order of operations in your expression matches the order of each event.  }

#eeeeee

#2E006758

#2EB00020

box12

randomBase = Shuffle(Sequence[0, 1500])
randomList1 = Shuffle(Sequence[20])
randomList2 = Shuffle(Sequence[15])
randomMultipliers = Shuffle({2, 3, 2, 3, 2, 3, 2, 3, 2, 3})
randomLow = Shuffle(Sequence[500, 1000])
highlightColor: colorTealSuccess
countQuestion = 0
low2 = Element(randomLow, Mod[countQuestion + 1, Length[randomLow]] + 1)
low1 = Element(randomLow, Mod[countQuestion, Length[randomLow]] + 1)
startVal: Element[randomBase, Mod[countQuestion, Length[randomBase]] + 1] + low1 + low2
possibleStepOrders: {{1, 2, 3}, {1, 1, 3}, {2, 1, 3}, {1, 3, 2}, {2, 3, 1}, {2, 3, 2}}
caseNum: Mod[countQuestion, Length[possibleStepOrders]] + 1
currentOrder = Element(possibleStepOrders, caseNum)
solnStep1: "\textcolor{" + (LaTeX[colorBlack]) + "}{" + (LaTeX[startVal]) + "}\bf\textcolor{" + (LaTeX[highlightColor]) + "}{" + (LaTeX[Element[{("+" * low1), ("-" * low1)}, currentOrder(1)]]) + "}"
multiplier = Element(randomMultipliers, Mod[countQuestion, Length[randomMultipliers]] + 1)
solnStep1NoHighlight = ReplaceAll(solnStep1, ("\bf\textcolor{" * highlightColor), ("\\textcolor{" * colorBlack))
solnStep2: "" + (LaTeX[Element[{(((((("" * solnStep1NoHighlight) * "\bf\textcolor{") * highlightColor) * "}{ +") * If[currentOrder(1) ≟ 3, low1, low2]) * "}"), (((((("" * solnStep1NoHighlight) * "\bf\textcolor{") * highlightColor) * "}{-") * If[currentOrder(1) ≟ 3, low1, low2]) * "}"), (((((((("\bf\textcolor{" * highlightColor) * "}{") * multiplier) * "(}") * solnStep1NoHighlight) * "\textcolor{") * highlightColor) * "}{)}")}, currentOrder(2)]]) + ""
solnStep2NoHighlight = ReplaceAll(solnStep2, ("\bf\textcolor{" * highlightColor), ("\\textcolor{" * colorBlack))
solnStep3: "" + (LaTeX[Element[{(((((solnStep2NoHighlight * "\textbf\textcolor{") * highlightColor) * "}{+") * low2) * "}"), (((((solnStep2NoHighlight * "\textbf\textcolor{") * highlightColor) * "}{-") * low2) * "}"), (((((((("\textbf\textcolor{" * highlightColor) * "}{") * multiplier) * "(}") * solnStep2NoHighlight) * "\textbf\textcolor{") * highlightColor) * "}{)}")}, currentOrder(3)]]) + ""
studentAns: {"-", "(", ")", "3", "2", "535", "656", ")"}
correct6: studentAns ≟ {("" * multiplier), "(", ("" * startVal), "-", ("" * low1), ")", "-", ("" * low2)} ∨ studentAns ≟ {"(", ("" * startVal), "-", ("" * low1), ")", ("" * multiplier), "-", ("" * low2)}
correct5: studentAns ≟ {("" * multiplier), "(", ("" * startVal), "-", ("" * low1), ")", "+", ("" * low2)} ∨ studentAns ≟ {"(", ("" * startVal), "-", ("" * low1), ")", ("" * multiplier), "+", ("" * low2)}
correct4: studentAns ≟ {("" * multiplier), "(", ("" * startVal), "+", ("" * low1), ")", "-", ("" * low2)} ∨ studentAns ≟ {"(", ("" * startVal), "+", ("" * low1), ")", ("" * multiplier), "-", ("" * low2)}
correct3: studentAns ≟ {("" * multiplier), "(", ("" * startVal), "-", ("" * low1), "+", ("" * low2), ")"} ∨ studentAns ≟ {"(", ("" * startVal), "-", ("" * low1), "+", ("" * low2), ")", ("" * multiplier)}
correct2: studentAns ≟ {("" * multiplier), "(", ("" * startVal), "+", ("" * low1), "+", ("" * low2), ")"} ∨ studentAns ≟ {"(", ("" * startVal), "+", ("" * low1), "+", ("" * low2), ")", ("" * multiplier)}
correct1: studentAns ≟ {("" * multiplier), "(", ("" * startVal), "+", ("" * low1), "-", ("" * low2), ")"} ∨ studentAns ≟ {"(", ("" * startVal), "+", ("" * low1), "-", ("" * low2), ")", ("" * multiplier)}
P1 = (-26.115702479338843, 26.293634496919918)
P2 = (-26.115702479338843, 26.293634496919918)
P3 = (-26.115702479338843, 26.293634496919918)
P4 = (-6.615702479338843, 26.293634496919918)
P5 = (-6.615702479338843, 26.293634496919918)
P6 = (-6.615702479338843, 26.293634496919918)
P7 = (12.884297520661157, 26.293634496919918)
P8 = (12.884297520661157, 26.293634496919918)
P9 = (12.884297520661157, 26.293634496919918)
P10 = (32.38429752066116, 26.293634496919918)
P11 = (32.38429752066116, 26.293634496919918)
P12 = (32.38429752066116, 26.293634496919918)
P13 = (51.88429752066116, 26.293634496919918)
P14 = (71.38429752066116, 26.293634496919918)
P15 = (90.88429752066116, 26.293634496919918)
P16 = (110.38429752066116, 26.293634496919918)
movingPoints: {P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16}
randomNum2 = Element(randomList2, Mod[countQuestion, 15] + 1)
input2 = NaN
randomNum1 = Element(randomList1, Mod[countQuestion, 20] + 1)
input1: NaN
validate = false
showanswer = false
showsolution = false
tries = 0
countCorrect = 0
showhint = false
correct = Element({correct1, correct2, correct3, correct4, correct5, correct6}, caseNum)
showbuttons = true
typicalError1: 0
typicalError2: 0
showhinttypicalerror = false
textCountCorrect: "\text{Number correct: " + (LaTeX[countCorrect]) + " }"
labelBtnValidate: "\text{CHECK (" + (LaTeX[3 - tries]) + ")}"
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)}])
textHint: "\text{\color{" + (LaTeX[colorOrange]) + "}\bold{Hint}\\" + (LaTeX[If[showhinttypicalerror, helpTextHintTypicalError]]) + "" + (LaTeX[If[showhint ∧ showhinttypicalerror, "\\"]]) + "" + (LaTeX[If[showhint, helpTextHint]]) + "}"
layoutY: 300
enableInput: tries < 3 ∧ (¬(validate ∧ correct))
layoutX: 16
layoutAppSize = Corner(5)
inputCurrent: movingPoints
inputSaved: {(-26.115702479338843, 26.293634496919918), (-26.115702479338843, 26.293634496919918), (-26.115702479338843, 26.293634496919918), (-6.615702479338843, 26.293634496919918), (-6.615702479338843, 26.293634496919918), (-6.615702479338843, 26.293634496919918), (12.884297520661157, 26.293634496919918), (12.884297520661157, 26.293634496919918), (12.884297520661157, 26.293634496919918), (32.38429752066116, 26.293634496919918), (32.38429752066116, 26.293634496919918), (32.38429752066116, 26.293634496919918), (51.88429752066116, 26.293634496919918), (71.38429752066116, 26.293634496919918), (90.88429752066116, 26.293634496919918), (110.38429752066116, 26.293634496919918)}
enableBtnValidate: inputCurrent ≠ inputSaved
textFeedback: "" + (LaTeX[If[correct, "$\text{✓ Correct}$", "$\text{✕ " + (If[tries < 3, "Try again", "Maybe next time"]) + "}$"]]) + ""
movingIndex = NaN
organizing = false
boxWidth: 13
boxHeight: boxWidth
PMove = Element(movingPoints, movingIndex)
Anchor = (-16.115702479338843, 11.293634496919918)
HomeAnchor: Anchor + (-10, 15)
homePoints = Sequence(HomeAnchor + (((A * 1.5) * boxWidth), 0), A, 0, 8)
innerSize: 13
box1 = centerBox(innerSize, innerSize, P1)
box2 = centerBox(innerSize, innerSize, P2)
box3 = centerBox(innerSize, innerSize, P3)
box4 = centerBox(innerSize, innerSize, P4)
box5 = centerBox(innerSize, innerSize, P5)
box6 = centerBox(innerSize, innerSize, P6)
box7 = centerBox(innerSize, innerSize, P7)
box8 = centerBox(innerSize, innerSize, P8)
box9 = centerBox(innerSize, innerSize, P9)
box10 = centerBox(innerSize, innerSize, P10)
box11 = centerBox(innerSize, innerSize, P11)
box12 = centerBox(innerSize, innerSize, P12)
box13 = centerBox(innerSize, innerSize, P13)
box14 = centerBox(innerSize, innerSize, P14)
box15 = centerBox(innerSize, innerSize, P15)
highlightBox = centerBox(innerSize, innerSize, PMove)
framePoints = Sequence(Anchor + ((A * boxWidth), 0), A, 1, 8)
frame1 = centerBox(boxWidth, boxHeight, framePoints(1))
frame2 = centerBox(boxWidth, boxHeight, framePoints(2))
frame3 = centerBox(boxWidth, boxHeight, framePoints(3))
frame4 = centerBox(boxWidth, boxHeight, framePoints(4))
frame5 = centerBox(boxWidth, boxHeight, framePoints(5))
frame6 = centerBox(boxWidth, boxHeight, framePoints(6))
frame8 = centerBox(boxWidth, boxHeight, framePoints(8))
frame7 = centerBox(boxWidth, boxHeight, framePoints(7))
locationPMove = IndexOf(true, Zip[IsInRegion[PMove, A], A, {frame1, frame2, frame3, frame4, frame5, frame6, frame7, frame8}])
highlightFrame = Element({frame1, frame2, frame3, frame4, frame5, frame6, frame7, frame8}, locationPMove)
allTextStr: {"+", "+", "+", "-", "-", "-", "(", "(", "(", ")", ")", ")", ("" * multiplier), ("" * Min[low1, low2]), ("" * Max[low1, low2]), ("" * startVal)}
boxText = Zip(Text[("" * A), B, true, true, 0, 0], A, allTextStr, B, movingPoints)
homeIndices: {1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8}
homeLocations = Zip(homePoints(A), A, homeIndices)
HOME: -1
allHome = Zip(HOME, A, movingPoints)
currentLocations: {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}
cmdOrganize = Sequence((((((((("SetValue(P" * A) * ",If(currentLocations(") * A) * ")==HOME,homeLocations(") * A) * "),framePoints(currentLocations(") * A) * "))))"), A, 1, Length[movingPoints])
tmpIndex = NaN
box16 = centerBox(innerSize, innerSize, P16)
textHighlight = If(Defined[movingIndex], Text[allTextStr(movingIndex), PMove, true, true, 0, 0], "")
phrase1 = Element({(("He gains " * low1) * " points"), (("He loses " * low1) * " points"), ("His score " * If[multiplier ≟ 2, "doubles", "triples"])}, currentOrder(1))
phrase2 = Element({(("He gains " * If[currentOrder(1) ≟ 3, low1, low2]) * " points"), (("He loses " * If[currentOrder(1) ≟ 3, low1, low2]) * " points"), ("His score " * If[multiplier ≟ 2, "doubles", "triples"])}, currentOrder(2))
phrase3 = Element({(("he gains " * low2) * " points"), (("he loses " * low2) * " points"), ("his score " * If[multiplier ≟ 2, "doubles", "triples"])}, currentOrder(3))
cmdFixBoxes = Sequence((("SetFixed(box" * A) * ",false,enableInput)"), A, 1, Length[movingPoints])
cmdGetStudentAnswer = Zip((((("SetValue(studentAns," * If[A ≠ HOME, A, 1]) * ",") * If[A ≠ HOME, (("allTextStr(" * B) * ")"), "studentAns(1)"]) * ")"), A, currentLocations, B, Sequence[1, Length[currentLocations]])
isTypicalError: false
countQuestoin: 0
solnCol1: {("Step 1: " * phrase1), ("Step 2: " * phrase2), ("Step 3: The game ends and " * phrase3)}
solnCol2 = Zip((("\(" * A) * "\)"), A, {solnStep1, solnStep2, solnStep3})
textSolution: "\text{\bold{Possible Solution}\\" + (LaTeX[TableText[solnCol1, solnCol2, "vl"]]) + ""
textQuestion: "\text{At a certain point in the game, Eric has " + (LaTeX[startVal]) + " points, then the following happens in order:\\

\bullet " + (LaTeX[phrase1]) + " \\
\bullet " + (LaTeX[phrase2]) + " \\
\bullet The game ends and " + (LaTeX[phrase3]) + " \\
Write an expression to represent the total points Eric has at the end of the video game.\\
Design the expression so that it is evaluated in the same order in which point changes occur.}
}"

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