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

Commit

Permalink
Add exercise -- division 0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
marcia committed Jul 7, 2011
1 parent 8c1016c commit cd252b2
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions exercises/division_0.5.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html data-require="math graphie">
<head>
<title>Division 0.5</title>
<script src="../khan-exercise.js"></script>
<script>
function drawColumn( num, x, color, startCount ) {
with ( KhanUtil.currentGraph ) {
style({
stroke: color
});

for ( var y = 0; y < num; y++ ) {
label( [ x, y ], "\\small{\\color{" + color + "}{" + ( startCount + num - y ) + "}}" );
circle( [ x, y ], 0.25 );
}
}
}
</script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="A">randRange( 1, 10 )</var>
<var id="B">randRange( 1, 10 )</var>
<var id="C">A * B</var>
<var id="LABEL">{}</var>
</div>

<div class="problems">
<div>
<div class="graphie" id="numbers">
init({
range: [ [ -1, B + 1 ], [ -1, A + 1 ] ],
scale: [ 50, 50 ]
});

LABEL = label( [ 0, A ],
"\\Huge{\\color{ #6495ED }{ <var>C</var> } \\div \\color{ #FFA500 }{ <var>B</var> } = ?}", "right" );
</div>
<div class="solution"><var>A</var></div>
</div>
</div>
<div class="hints">
<div class="graphie" data-update="numbers">
for ( var i = 0; i &lt; B; i++ ) {
drawColumn( A, i, "#6495ED", A * i );
}
</div>
<div class="graphie" data-update="numbers">
style({
stroke: "#FFA500"
});
for ( var i = 1; i &lt; B; i++ ) {
path ( [ [ i - 0.5 , -0.5 ], [ i - 0.5 , A - 0.5 ] ]);
}
</div>
<div class="graphie" data-update="numbers">
LABEL.remove();
label( [ 0, A ],
"\\Huge{\\color{ #6495ED }{" + C + "} \\div \\color{ #FFA500 }{" + B + "} = " + A + "}", "right" );
</div>
</div>
</div>
</body>
</html>

0 comments on commit cd252b2

Please sign in to comment.