Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Port parabola intuition 1 to use a custom answer type

  • Loading branch information...
commit 61053c95835fd18b34650c242f3e1c00337f860b 1 parent 17c3d21
@joelburget joelburget authored
Showing with 39 additions and 16 deletions.
  1. +39 −16 exercises/parabola_intuition_1.html
View
55 exercises/parabola_intuition_1.html
@@ -36,45 +36,68 @@
style({
stroke: "#FFA500",
fill: "none",
- clipRect:[ [-10, -10], [20, 20] ],
+ clipRect:[[-10, -10], [20, 20]],
arrows: null
});
- plot( new Parabola( A, X1, Y1 ).graphieFunction, [-10, 10]);
+ plot(new Parabola(A, X1, Y1).graphieFunction, [-10, 10]);
style({
stroke: "#6495ED",
strokeWidth: 3,
fill: "none",
- clipRect:[ [-10, -10], [20, 20] ],
+ clipRect:[[-10, -10], [20, 20]],
arrows: null
});
- graph.currParabola = new Parabola( 1, 0, 0 );
+ graph.currParabola = new Parabola(1, 0, 0);
graph.currParabola.plot();
</div>
- <div class="solution" data-type="multiple">
+ <div class="solution" data-type="custom">
<!--
There didn't seem to be an easy way to bind handlers normally after everything had loaded.
It would also be nice to press and hold.
-->
- <input type="button" class="simple-button mini-button" style="margin-left: 20px;" value="+" onclick="updateParabola( 0, 0, -1)" />
- <input type="button" class="simple-button mini-button" style="margin-left: 8px;" value="+" onclick="updateParabola( 1, 0, 0)" />
- <input type="button" class="simple-button mini-button" style="margin-left: 20px;" value="+" onclick="updateParabola( 0, -1, 0)" />
+ <div class="instruction">
+ <div id="plus-buttons">
+ <input type="button" class="simple-button mini-button" style="margin-left: 20px;" value="+" onclick="updateParabola(0, 0, -1)" />
+ <input type="button" class="simple-button mini-button" style="margin-left: 8px;" value="+" onclick="updateParabola(1, 0, 0)" />
+ <input type="button" class="simple-button mini-button" style="margin-left: 20px;" value="+" onclick="updateParabola(0, -1, 0)" />
+ </div>
- <p id="equation-label" style="margin: 8px 0px 2px 0px"><code>y - 0 = 1(x - 0)^{2}</code></p>
+ <p id="equation-label" style="margin: 8px 0px 2px 0px"><code>y - 0 = 1(x - 0)^{2}</code></p>
- <div style="padding-bottom: 15px">
- <input type="button" class="simple-button mini-button" style="margin-left: 20px;" value="-" onclick="updateParabola( 0, 0, 1)" />
- <input type="button" class="simple-button mini-button" style="margin-left: 8px;" value="-" onclick="updateParabola( -1, 0, 0)" />
- <input type="button" class="simple-button mini-button" style="margin-left: 20px;" value="-" onclick="updateParabola( 0, 1, 0)" />
+ <div id="minus-buttons" style="padding-bottom: 15px">
+ <input type="button" class="simple-button mini-button" style="margin-left: 20px;" value="-" onclick="updateParabola(0, 0, 1)" />
+ <input type="button" class="simple-button mini-button" style="margin-left: 8px;" value="-" onclick="updateParabola(-1, 0, 0)" />
+ <input type="button" class="simple-button mini-button" style="margin-left: 20px;" value="-" onclick="updateParabola(0, 1, 0)" />
+ </div>
</div>
- <span class="sol" id="leading-coefficient" style="display: none"><var>A</var></span>
- <span class="sol" id="vertex-x" style="display: none"><var>X1</var></span>
- <span class="sol" id="vertex-y" style="display: none"><var>Y1</var></span>
+ <div class="guess">[A, X1, Y1]</div>
+ <div class="validator-function">
+ var parab = graph.currParabola;
+ return parab.getLeadingCoefficient() === A &amp;&amp;
+ parab.getVertexX() === X1 &amp;&amp;
+ parab.getVertexY() === Y1;
+ </div>
+ <div class="show-guess">
+ guess = guess.length ? guess : [1, 0, 0];
+ var parab = graph.currParabola;
+ parab.update.apply(parab, guess);
+ redrawParabola(false);
+ </div>
+ <div class="show-guess-solutionarea">
+ guess = guess.length ? guess : [1, 0, 0];
+ var a = guess[0],
+ x = guess[1],
+ y = guess[2];
+ var equation = "y - " + y + "=" + a + "(x - " + x + ")^{2}";
+ equation = cleanMath(equation);
+ $("#equation-label").html("&lt;code&gt;" + equation + "&lt;/code&gt;").tmpl();
+ </div>
</div>
</div>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.