Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
Multiplication hints show true value of numbers in intermediate steps
Browse files Browse the repository at this point in the history
Summary:
 Multiplication questions now shown without the long multiplication setup. Intermediate steps show true values of numbers.

Change how multiplication questions are shown and add final hint

Test Plan: Try all the multiplication exercises and make sure the hints make sense.

Reviewers: eater

Reviewed By: eater

Differential Revision: http://phabricator.khanacademy.org/D11892
  • Loading branch information
petercollingridge committed Sep 1, 2014
1 parent d35d7a3 commit 89ca3cc
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 48 deletions.
29 changes: 24 additions & 5 deletions exercises/multiplication_1.5.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
<html data-require="math graphie graphie-helpers graphie-helpers-arithmetic">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Multiplication without carrying</title>
<title>Multiplication without regrouping</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="ORDER">rand(2)</var>
<var id="SMALL_FACTOR">randRange( 2, 4 )</var>
<var id="NUM_DIGITS">randRange( 2, 3 )</var>
<var id="MAX_FACTOR_DIGIT">floor( 9 / SMALL_FACTOR )</var>
Expand All @@ -26,19 +27,37 @@

<div class="problems">
<div>
<br>
<p class="problem">
<span data-if="ORDER === 0">
<code>\large{<var>SMALL_FACTOR</var> \times <var>BIG_FACTOR</var> = {?}}</code>
</span><span data-else="">
<code>\large{<var>BIG_FACTOR</var> \times <var>SMALL_FACTOR</var> = {?}}</code>
</span>
</p>
<div class="graphie" id="numbers">
graph.multiplier = new Multiplier( BIG_FACTOR, SMALL_FACTOR );
graph.multiplier.show();
DUMMY = Array( graph.multiplier.getNumHints() );
graph.multiplier = new Multiplier(BIG_FACTOR, SMALL_FACTOR);
DUMMY = Array(graph.multiplier.getNumHints() - 1);
</div>
<div class="solution" data-forms="integer"><var>SMALL_FACTOR * BIG_FACTOR</var></div>
</div>
</div>
<div class="hints">
<div class="graphie" data-update="numbers">
graph.multiplier.show();
</div>
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.multiplier.showHint();
</div>
<div>
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.multiplier.showHint();
</div>
<p data-if="ORDER === 0">
<code>\large{<var>SMALL_FACTOR</var> \times <var>BIG_FACTOR</var> = <var>SMALL_FACTOR * BIG_FACTOR</var>}</code>
</p><p data-else="">
<code>\large{<var>BIG_FACTOR</var> \times <var>SMALL_FACTOR</var> = <var>SMALL_FACTOR * BIG_FACTOR</var>}</code>
</p>
</div>
</div>
</div>
</body>
Expand Down
29 changes: 24 additions & 5 deletions exercises/multiplication_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,51 @@
<html data-require="math graphie graphie-helpers graphie-helpers-arithmetic">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Multiplication with carrying</title>
<title>Multiplication with regrouping</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="ORDER">rand(2)</var>
<var id="SMALL_FACTOR">randRange(2, 9)</var>
<var id="BIG_FACTOR">randFromArray([randRange(100, 999), randRange(1000, 9999)])</var>
<var id="DUMMY">[]</var>
</div>

<div class="problems">
<div>
<br>
<p class="problem">
<span data-if="ORDER === 0">
<code>\large{<var>SMALL_FACTOR</var> \times <var>BIG_FACTOR</var> = {?}}</code>
</span><span data-else="">
<code>\large{<var>BIG_FACTOR</var> \times <var>SMALL_FACTOR</var> = {?}}</code>
</span>
</p>
<div class="graphie" id="numbers">
graph.multiplier = new Multiplier( BIG_FACTOR, SMALL_FACTOR );
graph.multiplier.show();
DUMMY = Array( graph.multiplier.getNumHints() );
graph.multiplier = new Multiplier(BIG_FACTOR, SMALL_FACTOR);
DUMMY = Array(graph.multiplier.getNumHints() - 1);
</div>
<div class="solution" data-forms="integer"><var>SMALL_FACTOR * BIG_FACTOR</var></div>
</div>
</div>
<div class="hints">
<div class="graphie" data-update="numbers">
graph.multiplier.show();
</div>
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.multiplier.showHint();
</div>
<div>
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.multiplier.showHint();
</div>
<p data-if="ORDER === 0">
<code>\large{<var>SMALL_FACTOR</var> \times <var>BIG_FACTOR</var> = <var>SMALL_FACTOR * BIG_FACTOR</var>}</code>
</p><p data-else="">
<code>\large{<var>BIG_FACTOR</var> \times <var>SMALL_FACTOR</var> = <var>SMALL_FACTOR * BIG_FACTOR</var>}</code>
</p>
</div>
</div>
</div>
</body>
Expand Down
31 changes: 25 additions & 6 deletions exercises/multiplication_3.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,45 @@
<body>
<div class="exercise">
<div class="vars">
<var id="SMALL_FACTOR">randRange( 10, 99 )</var>
<var id="BIG_FACTOR">randRange( 10, 99 )</var>
<var id="ORDER">rand(2)</var>
<var id="SMALL_FACTOR">randRange(10, 99)</var>
<var id="BIG_FACTOR">randRange(10, 99)</var>
<var id="DUMMY">[]</var>
</div>

<div class="problems">
<div>
<br>
<p class="problem">
<span data-if="ORDER === 0">
<code>\large{<var>SMALL_FACTOR</var> \times <var>BIG_FACTOR</var> = {?}}</code>
</span><span data-else="">
<code>\large{<var>BIG_FACTOR</var> \times <var>SMALL_FACTOR</var> = {?}}</code>
</span>
</p>
<div class="graphie" id="numbers">
graph.multiplier = new Multiplier( BIG_FACTOR, SMALL_FACTOR );
graph.multiplier.show();
DUMMY = Array( graph.multiplier.getNumHints() );
graph.multiplier = new Multiplier(BIG_FACTOR, SMALL_FACTOR);
DUMMY = Array(graph.multiplier.getNumHints() - 1);
</div>
<div class="solution" data-forms="integer"><var>SMALL_FACTOR * BIG_FACTOR</var></div>
</div>
</div>
<div class="hints">
<div class="graphie" data-update="numbers">
graph.multiplier.show();
</div>
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.multiplier.showHint();
</div>
<div>
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.multiplier.showHint();
</div>
<p data-if="ORDER === 0">
<code>\large{<var>SMALL_FACTOR</var> \times <var>BIG_FACTOR</var> = <var>SMALL_FACTOR * BIG_FACTOR</var>}</code>
</p><p data-else="">
<code>\large{<var>BIG_FACTOR</var> \times <var>SMALL_FACTOR</var> = <var>SMALL_FACTOR * BIG_FACTOR</var>}</code>
</p>
</div>
</div>
</div>
</body>
Expand Down
25 changes: 22 additions & 3 deletions exercises/multiplication_4.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<body>
<div class="exercise">
<div class="vars" data-ensure="SMALL_FACTOR < BIG_FACTOR">
<var id="ORDER">rand(2)</var>
<var id="SMALL_FACTOR">randFromArray([
randRange(10, 99),
randRange(10, 99),
Expand All @@ -23,19 +24,37 @@

<div class="problems">
<div>
<br>
<p class="problem">
<span data-if="ORDER === 0">
<code>\large{<var>SMALL_FACTOR</var> \times <var>BIG_FACTOR</var> = {?}}</code>
</span><span data-else="">
<code>\large{<var>BIG_FACTOR</var> \times <var>SMALL_FACTOR</var> = {?}}</code>
</span>
</p>
<div class="graphie" id="numbers">
graph.multiplier = new Multiplier(BIG_FACTOR, SMALL_FACTOR);
graph.multiplier.show();
DUMMY = Array(graph.multiplier.getNumHints());
DUMMY = Array(graph.multiplier.getNumHints() - 1);
</div>
<div class="solution" data-forms="integer"><var>SMALL_FACTOR * BIG_FACTOR</var></div>
</div>
</div>
<div class="hints">
<div class="graphie" data-update="numbers">
graph.multiplier.show();
</div>
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.multiplier.showHint();
</div>
<div>
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.multiplier.showHint();
</div>
<p data-if="ORDER === 0">
<code>\large{<var>SMALL_FACTOR</var> \times <var>BIG_FACTOR</var> = <var>SMALL_FACTOR * BIG_FACTOR</var>}</code>
</p><p data-else="">
<code>\large{<var>BIG_FACTOR</var> \times <var>SMALL_FACTOR</var> = <var>SMALL_FACTOR * BIG_FACTOR</var>}</code>
</p>
</div>
</div>
</div>
</body>
Expand Down
17 changes: 11 additions & 6 deletions exercises/multiplying_decimals.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,32 @@

<div class="problems">
<div>
<br>
<p class="problem"><code>
\Large{<var>localeToFixed(BIG_FACTOR * pow(10, -BIG_FACTOR_DECIMAL), BIG_FACTOR_DECIMAL)</var> \times
<var>localeToFixed(SMALL_FACTOR * pow(10, -SMALL_FACTOR_DECIMAL), SMALL_FACTOR_DECIMAL)</var> = {?}}
</code></p>
<div class="graphie" id="numbers">
graph.multiplier = new Multiplier( BIG_FACTOR, SMALL_FACTOR, BIG_FACTOR_DIGITS, SMALL_FACTOR_DIGITS, BIG_FACTOR_DECIMAL, SMALL_FACTOR_DECIMAL );
graph.multiplier.show();
graph.multiplier.showDecimals();
graph.multiplier = new Multiplier(BIG_FACTOR, SMALL_FACTOR, BIG_FACTOR_DIGITS, SMALL_FACTOR_DIGITS, BIG_FACTOR_DECIMAL, SMALL_FACTOR_DECIMAL);
DUMMY = Array( graph.multiplier.getNumHints() );
</div>
<div class="solution" data-type="decimal"><var>ANSWER</var></div>
</div>
</div>
<div class="hints">
<div class="graphie" data-update="numbers">
graph.multiplier.show();
graph.multiplier.showDecimals();
</div>
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.multiplier.showHint();
</div>
<div class="graphie" data-update="numbers">
graph.multiplier.showDecimalsInProduct();
</div>
<p><code>
<p><code>\Large{
<var>localeToFixed(BIG_FACTOR * pow(10, -BIG_FACTOR_DECIMAL), BIG_FACTOR_DECIMAL)</var> \times
<var>localeToFixed(SMALL_FACTOR * pow(10, -SMALL_FACTOR_DECIMAL), SMALL_FACTOR_DECIMAL)</var> =
<var>localeToFixed(ANSWER, BIG_FACTOR_DECIMAL + SMALL_FACTOR_DECIMAL)</var>
<var>localeToFixed(ANSWER, BIG_FACTOR_DECIMAL + SMALL_FACTOR_DECIMAL)</var>}
</code></p>
</div>
</div>
Expand Down
17 changes: 11 additions & 6 deletions exercises/multiplying_decimals_0.5.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,32 @@

<div class="problems">
<div>
<br>
<p class="problem"><code>
\Large{<var>localeToFixed(BIG_FACTOR * pow(10, -BIG_FACTOR_DECIMAL), BIG_FACTOR_DECIMAL)</var> \times
<var>localeToFixed(SMALL_FACTOR * pow(10, -SMALL_FACTOR_DECIMAL), SMALL_FACTOR_DECIMAL)</var> = {?}}
</code></p>
<div class="graphie" id="numbers">
graph.multiplier = new Multiplier( BIG_FACTOR, SMALL_FACTOR, BIG_FACTOR_DIGITS, SMALL_FACTOR_DIGITS, BIG_FACTOR_DECIMAL, SMALL_FACTOR_DECIMAL );
graph.multiplier.show();
graph.multiplier.showDecimals();
graph.multiplier = new Multiplier(SMALL_FACTOR, BIG_FACTOR, SMALL_FACTOR_DIGITS, BIG_FACTOR_DIGITS, SMALL_FACTOR_DECIMAL, BIG_FACTOR_DECIMAL);
DUMMY = Array( graph.multiplier.getNumHints() );
</div>
<div class="solution" data-type="decimal"><var>ANSWER</var></div>
</div>
</div>
<div class="hints">
<div class="graphie" data-update="numbers">
graph.multiplier.show();
graph.multiplier.showDecimals();
</div>
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.multiplier.showHint();
</div>
<div class="graphie" data-update="numbers">
graph.multiplier.showDecimalsInProduct();
</div>
<p><code>
<p><code>\Large{
<var>localeToFixed(BIG_FACTOR * pow(10, -BIG_FACTOR_DECIMAL), BIG_FACTOR_DECIMAL)</var> \times
<var>localeToFixed(SMALL_FACTOR * pow(10, -SMALL_FACTOR_DECIMAL), SMALL_FACTOR_DECIMAL)</var> =
<var>localeToFixed(ANSWER, BIG_FACTOR_DECIMAL + SMALL_FACTOR_DECIMAL)</var>
<var>localeToFixed(ANSWER, BIG_FACTOR_DECIMAL + SMALL_FACTOR_DECIMAL)</var>}
</code></p>
</div>
</div>
Expand Down
15 changes: 10 additions & 5 deletions exercises/multiplying_decimals_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,32 @@

<div class="problems">
<div>
<br>
<p class="problem"><code>\Large{
<var>localeToFixed(BIG_FACTOR * pow(10, -BIG_FACTOR_DECIMAL), BIG_FACTOR_DECIMAL)</var> \times
<var>localeToFixed(SMALL_FACTOR * pow(10, -SMALL_FACTOR_DECIMAL), SMALL_FACTOR_DECIMAL)</var> = {?}}
</code></p>
<div class="graphie" id="numbers">
graph.multiplier = new Multiplier( BIG_FACTOR, SMALL_FACTOR, BIG_FACTOR_DIGITS, SMALL_FACTOR_DIGITS, BIG_FACTOR_DECIMAL, SMALL_FACTOR_DECIMAL );
graph.multiplier.show();
graph.multiplier.showDecimals();
DUMMY = Array( graph.multiplier.getNumHints() );
</div>
<div class="solution" data-type="decimal"><var>ANSWER</var></div>
</div>
</div>
<div class="hints">
<div class="graphie" data-update="numbers">
graph.multiplier.show();
graph.multiplier.showDecimals();
</div>
<div class="graphie" data-each="DUMMY as dummy" data-update="numbers">
graph.multiplier.showHint();
</div>
<div class="graphie" data-update="numbers">
graph.multiplier.showDecimalsInProduct();
</div>
<p><code>
<p><code>\Large{
<var>localeToFixed(BIG_FACTOR * pow(10, -BIG_FACTOR_DECIMAL), BIG_FACTOR_DECIMAL)</var> \times
<var>localeToFixed(SMALL_FACTOR * pow(10, -SMALL_FACTOR_DECIMAL), SMALL_FACTOR_DECIMAL)</var> =
<var>localeToFixed(ANSWER, BIG_FACTOR_DECIMAL + SMALL_FACTOR_DECIMAL)</var>
<var>localeToFixed(ANSWER, BIG_FACTOR_DECIMAL + SMALL_FACTOR_DECIMAL)</var>}
</code></p>
</div>
</div>
Expand Down
Loading

0 comments on commit 89ca3cc

Please sign in to comment.