This repository has been archived by the owner on May 11, 2021. It is now read-only.
/
multiplication_4.html
65 lines (61 loc) · 2.17 KB
/
multiplication_4.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html data-require="math graphie graphie-helpers-arithmetic">
<head>
<meta charset="UTF-8" />
<title>Multiplication 4</title>
<script src="../khan-exercise.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="SMALL_FACTOR">randRange( 10, 99 )</var>
<var id="BIG_FACTOR">randRange( 100, 999 )</var>
<var id="PRODUCT">SMALL_FACTOR * BIG_FACTOR</var>
<var id="PRODUCT_DIGITS">integerToDigits( PRODUCT )</var>
<var id="SMALL_FACTOR_DIGITS">digits( SMALL_FACTOR )</var>
<var id="BIG_FACTOR_DIGITS">digits( BIG_FACTOR )</var>
</div>
<div class="problems">
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -2 - PRODUCT_DIGITS.length, 12 ], [ -1 - SMALL_FACTOR_DIGITS.length * BIG_FACTOR_DIGITS.length / 2, 3 ] ],
scale: [ 30, 45 ]
});
style({
strokeWidth: 1
});
initMultiplication( SMALL_FACTOR_DIGITS, BIG_FACTOR_DIGITS, PRODUCT_DIGITS );
</div>
<div class="solution" data-forms="integer"><var>PRODUCT</var></div>
</div>
</div>
<div class="hints">
<div data-each="SMALL_FACTOR_DIGITS as smallIndex, smallDigit" data-unwrap>
<div data-each="BIG_FACTOR_DIGITS as bigIndex, bigDigit" class="graphie" data-update="numbers">
var bigIndex = <var>bigIndex</var>;
var smallIndex = <var>smallIndex</var>;
doMultiplicationStep( bigIndex, BIG_FACTOR_DIGITS, smallIndex, SMALL_FACTOR_DIGITS );
</div>
</div>
<div data-if="SMALL_FACTOR_DIGITS.length > 1" data-unwrap>
<div class="graphie" data-update="numbers">
while( graph.highlights.length ) {
graph.highlights.pop().remove();
}
path( [ [ -1 - PRODUCT_DIGITS.length, 0.5 - SMALL_FACTOR_DIGITS.length ], [ 1, 0.5 - SMALL_FACTOR_DIGITS.length ] ] );
label( [ -1 - PRODUCT_DIGITS.length, 1 - SMALL_FACTOR_DIGITS.length ] ,"\\huge{+\\vphantom{0}}" );
</div>
<div class="graphie" data-update="numbers">
drawDigits( PRODUCT_DIGITS, 1 - PRODUCT_DIGITS.length, -2 );
</div>
</div>
<div data-else class="graphie" data-update="numbers">
while( graph.highlights.length ) {
graph.highlights.pop().remove();
}
</div>
</div>
</div>
</body>
</html>