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

Commit

Permalink
Expand arithmetic's graphie ranges to fit labels.
Browse files Browse the repository at this point in the history
I want to redo arithmetic properly one day, but I'll let it fester for now.
  • Loading branch information
marcia committed Aug 10, 2011
1 parent 556285f commit f2a9138
Show file tree
Hide file tree
Showing 24 changed files with 36 additions and 34 deletions.
4 changes: 2 additions & 2 deletions exercises/adding_decimals.html
Expand Up @@ -51,7 +51,7 @@
<div class="hints">
<div class="graphie" id="numbers">
init({
range: [ [ -1, X_SIDE ], [ -0.5, 3 ] ],
range: [ [ -2, 17 ], [ -0.5, 3 ] ],
scale: [30, 45]
});
style({
Expand All @@ -60,7 +60,7 @@

X_MAX = X_MAX + ( B_DECIMAL - A_DECIMAL ) * (A_DECIMAL &lt; B_DECIMAL ? 1 : -1);
path( [ [ -0.5, Y_SECOND - 0.5 ], [ X_MAX + 0.5, Y_SECOND - 0.5 ] ]);
HIGHLIGHTS.push( label( [ X_SIDE, Y_SIDE ], "\\large{\\text{Make sure the decimals are lined up.}}", "right" ) );
HIGHLIGHTS.push( label( [ X_SIDE, Y_SIDE ], "\\text{Make sure the decimals are lined up.}", "right" ) );
drawDigits( A_DIGITS.slice( 0 ).reverse(), X_MAX - A_DIGITS.length + 1, Y_FIRST );
drawDigits( B_DIGITS.slice( 0 ).reverse(), X_MAX - B_DIGITS.length + 1, Y_SECOND );
for ( var i = 0; i &lt; 3; i++ ){
Expand Down
2 changes: 1 addition & 1 deletion exercises/addition_1.html
Expand Up @@ -17,7 +17,7 @@
<div class="question">
<div class="graphie">
init({
range: [ [0, 0], [0, 1] ]
range: [ [0, 12], [-1, 1] ]
});

label( [0, 0],
Expand Down
2 changes: 1 addition & 1 deletion exercises/addition_2.html
Expand Up @@ -28,7 +28,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1, 5 ], [ -0.5, 3 ] ],
range: [ [ -1, 11 ], [ -0.5, 3.5 ] ],
scale: [30, 45]
});
drawDigits( A_DIGITS.slice( 0 ).reverse(), X_MAX - A_DIGITS.length + 1, Y_FIRST );
Expand Down
2 changes: 1 addition & 1 deletion exercises/addition_3.html
Expand Up @@ -28,7 +28,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1, 5 ], [ -0.5, 3 ] ],
range: [ [ -1, 11 ], [ -0.5, 3.5 ] ],
scale: [30, 45]
});
drawDigits( A_DIGITS.slice( 0 ).reverse(), X_MAX - A_DIGITS.length + 1, Y_FIRST );
Expand Down
2 changes: 1 addition & 1 deletion exercises/addition_4.html
Expand Up @@ -28,7 +28,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1, 5 ], [ -0.5, 3 ] ],
range: [ [ -1, 11 ], [ -0.5, 3.5 ] ],
scale: [30, 45]
});
drawDigits( A_DIGITS.slice( 0 ).reverse(), X_MAX - A_DIGITS.length + 1, Y_FIRST );
Expand Down
2 changes: 1 addition & 1 deletion exercises/dividing_decimals.html
Expand Up @@ -28,7 +28,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -2 - DIVISOR_DIGITS.length, DIVIDEND_DIGITS.length + 2 ], [ DIVIDEND_DIGITS.length * -2 - 1, 2 ] ],
range: [ [ -2 - DIVISOR_DIGITS.length, 17 ], [ DIVIDEND_DIGITS.length * -2 - 1, 2 ] ],
scale: [ 30, 45 ]
});
style({
Expand Down
2 changes: 1 addition & 1 deletion exercises/division_0.5.html
Expand Up @@ -18,7 +18,7 @@
<div class="graphie" id="numbers">
var bottomBoundary = ( B === 1 ) ? A - 1 : -1;
init({
range: [ [ -1, B + 1 ], [ bottomBoundary, A + 1 ] ],
range: [ [ -1, 10 ], [ bottomBoundary, A + 1 ] ],
scale: [ 50, 50 ]
});

Expand Down
2 changes: 1 addition & 1 deletion exercises/division_1.5.html
Expand Up @@ -32,7 +32,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1 - DIVISOR_DIGITS.length, DIVIDEND_DIGITS.length + 2 ], [ DIVIDEND_DIGITS.length * -2 - 1, 2 ] ],
range: [ [ -1 - DIVISOR_DIGITS.length, 17], [ DIVIDEND_DIGITS.length * -2 - 1, 2 ] ],
scale: [ 30, 45 ]
});
style({
Expand Down
2 changes: 1 addition & 1 deletion exercises/division_1.html
Expand Up @@ -18,7 +18,7 @@
<div class="graphie" id="numbers">
var bottomBoundary = ( B === 1 ) ? A - 1 : -1;
init({
range: [ [ -1, B + 1 ], [ bottomBoundary, A + 1 ] ],
range: [ [ -1, 10 ], [ bottomBoundary, A + 1 ] ],
scale: [ 50, 50 ]
});

Expand Down
2 changes: 1 addition & 1 deletion exercises/division_2.html
Expand Up @@ -23,7 +23,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1 - DIVISOR_DIGITS.length, DIVIDEND_DIGITS.length + 2 ], [ DIVIDEND_DIGITS.length * -2 - 1, 2 ] ],
range: [ [ -1 - DIVISOR_DIGITS.length, 17 ], [ DIVIDEND_DIGITS.length * -2 - 1, 2 ] ],
scale: [ 30, 45 ]
});
style({
Expand Down
2 changes: 1 addition & 1 deletion exercises/division_3.html
Expand Up @@ -26,7 +26,7 @@

<div class="graphie" id="numbers">
init({
range: [ [ -1 - DIVISOR_DIGITS.length, DIVIDEND_DIGITS.length + 2 ], [ DIVIDEND_DIGITS.length * -2 - 1, 2 ] ],
range: [ [ -1 - DIVISOR_DIGITS.length, 17 ], [ DIVIDEND_DIGITS.length * -2 - 1, 2 ] ],
scale: [ 30, 45 ]
});
style({
Expand Down
2 changes: 1 addition & 1 deletion exercises/division_4.html
Expand Up @@ -23,7 +23,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1 - DIVISOR_DIGITS.length, DIVIDEND_DIGITS.length + 2 ], [ DIVIDEND_DIGITS.length * -2 - 1, 2 ] ],
range: [ [ -1 - DIVISOR_DIGITS.length, 17 ], [ DIVIDEND_DIGITS.length * -2 - 1, 2 ] ],
scale: [ 30, 45 ]
});
style({
Expand Down
12 changes: 7 additions & 5 deletions exercises/multiplication_0.5.html
Expand Up @@ -16,7 +16,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1, A + 1 ], [ -3, B + 1 ] ],
range: [ [ -1, 12 ], [ -3, B + 1 ] ],
scale: [ 50, 50 ]
});
KhanUtil.currentGraph.labelHolder = label( [ 0, B ],
Expand All @@ -29,16 +29,18 @@
<div data-if="B > 0" data-unwrap>
<div>
<div class="graphie" data-update="numbers">
label( [ 0, B - 1 ], "\\large{\\text{Draw " + plural( A, "circle" ) + ".}}", "right" );
label( [ 0, B - 1 ], "\\text{Draw " + plural( A, "circle" ) + ".}", "right" );
drawRow( A, B - 3, "#6495ED", 1 );
</div>
</div>
<div>
<div class="graphie" data-update="numbers">
label( [ 0, B - 2 ], "\\large{\\text{"
label( [ 0, B - 2 ], "\\text{"
+ "If there" + ( B === 1 ? " is " : " are " ) + plural( B, "row" )
+ " with " + plural( A, "circle" ) + ( B === 1 ? " " : " each " ) + ", there is a total of how many circles?"
+ "}}", "right" );
+ " with " + plural( A, "circle" ) + ( B === 1 ? " " : " each " )
+ ", there is a total of how many circles?"
+ "}",
"right" );
for ( var i = 1; i &lt; B; i++ ) {
drawRow( A, B - 3 - i, "#28AE7B", A * i + 1 );
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/multiplication_1.5.html
Expand Up @@ -31,7 +31,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1 - PRODUCT_DIGITS.length, 3 ], [ -1 - SMALL_FACTOR_DIGITS.length, 3 ] ],
range: [ [ -1 - PRODUCT_DIGITS.length, 12 ], [ -1 - SMALL_FACTOR_DIGITS.length, 3 ] ],
scale: [ 30, 45 ]
});

Expand Down
10 changes: 5 additions & 5 deletions exercises/multiplication_1.html
Expand Up @@ -9,14 +9,14 @@
<div class="exercise">
<div class="vars">
<var id="A">randRange( 1, 10 )</var>
<var id="B">randRange( 1, 10 )</var>
<var id="B">randRange( 0, 10 )</var>
</div>

<div class="problems">
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1, A + 1 ], [ -3, B + 1 ] ],
range: [ [ -1, 12], [ -3, B + 1 ] ],
scale: [ 50, 50 ]
});
KhanUtil.currentGraph.labelHolder = label( [ 0, B ],
Expand All @@ -29,16 +29,16 @@
<div data-if="B > 0" data-unwrap>
<div>
<div class="graphie" data-update="numbers">
label( [ 0, B - 1 ], "\\large{\\text{Draw " + plural( A, "circle" ) + ".}}", "right" );
label( [ 0, B - 1 ], "\\text{Draw " + plural( A, "circle" ) + ".}", "right" );
drawRow( A, B - 3, "#6495ED", 1 );
</div>
</div>
<div>
<div class="graphie" data-update="numbers">
label( [ 0, B - 2 ], "\\large{\\text{"
label( [ 0, B - 2 ], "\\text{"
+ "If there" + ( B === 1 ? " is " : " are " ) + plural( B, "row" )
+ " with " + plural( A, "circle" ) + ( B === 1 ? " " : " each " ) + ", there is a total of how many circles?"
+ "}}", "right" );
+ "}", "right" );
for ( var i = 1; i &lt; B; i++ ) {
drawRow( A, B - 3 - i, "#28AE7B", A * i + 1 );
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/multiplication_2.html
Expand Up @@ -20,7 +20,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1 - PRODUCT_DIGITS.length, 3 ], [ -1 - SMALL_FACTOR_DIGITS.length, 3 ] ],
range: [ [ -1 - PRODUCT_DIGITS.length, 12 ], [ -1 - SMALL_FACTOR_DIGITS.length, 3 ] ],
scale: [ 30, 45 ]
});

Expand Down
2 changes: 1 addition & 1 deletion exercises/multiplication_3.html
Expand Up @@ -20,7 +20,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1 - PRODUCT_DIGITS.length, 3 ], [ -1 - SMALL_FACTOR_DIGITS.length, 3 ] ],
range: [ [ -1 - PRODUCT_DIGITS.length, 12 ], [ -1 - SMALL_FACTOR_DIGITS.length, 3 ] ],
scale: [ 30, 45 ]
});

Expand Down
2 changes: 1 addition & 1 deletion exercises/multiplication_4.html
Expand Up @@ -20,7 +20,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1 - PRODUCT_DIGITS.length, 3 ], [ -1 - SMALL_FACTOR_DIGITS.length, 3 ] ],
range: [ [ -2 - PRODUCT_DIGITS.length, 12 ], [ -1 - SMALL_FACTOR_DIGITS.length * BIG_FACTOR_DIGITS.length / 2, 3 ] ],
scale: [ 30, 45 ]
});

Expand Down
2 changes: 1 addition & 1 deletion exercises/multiplying_decimals.html
Expand Up @@ -23,7 +23,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1 - MAX_NUM_DIGITS, 3 ], [ -1 - SMALL_FACTOR_DIGITS.length, 3 ] ],
range: [ [ -2 - MAX_NUM_DIGITS, 12 ], [ -5 - SMALL_FACTOR_DIGITS.length * BIG_FACTOR_DIGITS.length / 2, 3 ] ],
scale: [ 30, 45 ]
});

Expand Down
4 changes: 2 additions & 2 deletions exercises/subtracting_decimals.html
Expand Up @@ -49,7 +49,7 @@
<div class="hints">
<div class="graphie" id="numbers">
init({
range: [ [ -1, X_MAX + 4 ], [ -0.5, 4 ] ],
range: [ [ -2, 17 ], [ -0.5, 4 ] ],
scale: [30, 45]
});
style({
Expand All @@ -71,7 +71,7 @@
}
X_MAX = X_MAX + ( B_DECIMAL - A_DECIMAL ) * (A_DECIMAL &lt; B_DECIMAL ? 1 : -1);
path( [ [ -0.5, 0.5 ], [ X_MAX + 0.5, 0.5 ] ]);
graph.highlights[0].push( label( [ X_SIDE, Y_SIDE ], "\\large{\\text{Make sure the decimals are lined up.}}", "right" ) );
graph.highlights[0].push( label( [ X_SIDE, Y_SIDE ], "\\text{Make sure the decimals are lined up.}", "right" ) );
drawDigits( A_DIGITS.slice( 0 ).reverse(), X_MAX - A_DIGITS.length + 1, Y_FIRST );
drawDigits( B_DIGITS.slice( 0 ).reverse(), X_MAX - B_DIGITS.length + 1, Y_SECOND );
for ( var i = 0; i &lt; 3; i++ ){
Expand Down
2 changes: 1 addition & 1 deletion exercises/subtraction_1.html
Expand Up @@ -17,7 +17,7 @@
<div class="question">
<div class="graphie">
init({
range: [ [0, 0], [0, 1] ]
range: [ [0, 12], [-1, 1] ]
});

label( [0, 0],
Expand Down
2 changes: 1 addition & 1 deletion exercises/subtraction_2.html
Expand Up @@ -26,7 +26,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1, 3 ], [ -0.5, 4 ] ],
range: [ [ -1, 12 ], [ -0.5, 4 ] ],
scale: [30, 45]
});
drawDigits( A_DIGITS.slice( 0 ).reverse(), X_MAX - A_DIGITS.length + 1, Y_FIRST );
Expand Down
2 changes: 1 addition & 1 deletion exercises/subtraction_3.html
Expand Up @@ -26,7 +26,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1, X_MAX + 1 ], [ -0.5, 4 ] ],
range: [ [ -1, 12 ], [ -0.5, 4 ] ],
scale: [30, 45]
});
drawDigits( A_DIGITS.slice( 0 ).reverse(), X_MAX - A_DIGITS.length + 1, Y_FIRST );
Expand Down
2 changes: 1 addition & 1 deletion exercises/subtraction_4.html
Expand Up @@ -26,7 +26,7 @@
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1, X_MAX + 1 ], [ -0.5, 4 ] ],
range: [ [ -1, 12 ], [ -0.5, 4 ] ],
scale: [30, 45]
});
drawDigits( A_DIGITS.slice( 0 ).reverse(), X_MAX - A_DIGITS.length + 1, Y_FIRST );
Expand Down

0 comments on commit f2a9138

Please sign in to comment.