<!DOCTYPE html>
<html data-require="math graphie graphie-helpers-arithmetic word-problems">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Subtract within 20</title>
    <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
    <div class="exercise">
        <div class="vars">
            <var id="A">randRange(2, 20)</var>
            <var id="B">randRange(1, A - 1)</var>
        </div>

        <div class="problems">
            <div>
                <div class="question">
                    <div class="graphie">
                        init({
                            range: [[0, 12], [-1, 1]]
                        });

                        var equation = rand(2) === 0 ?
                            "\\Huge{\\blue{" + A + "} - \\red{" + B + "} = {?}}" :
                            "\\Huge{{?} = \\blue{" + A + "} - \\red{" + B + "}}"

                        label([0, 0], equation, "right");
                    </div>
                </div>
                <div class="solution" data-forms="integer"><var>A - B</var></div>
                <div class="hints">
                    <div class="graphie" id="circles" style="float: left;">
                        drawCircles(A, BLUE);
                    </div>
                    <div class="graphie" data-update="circles">
                        crossOutCircles(A, B, RED);
                    </div>
                    <p style="clear: left;">
                        <span data-if="isSingular(A)">We began with <code>\blue{<var>A</var>}</code> dot and crossed out <code>\red{<var>B</var>}</code> of them.</span>
                        <span data-else="">We began with <code>\blue{<var>A</var>}</code> dots and crossed out <code>\red{<var>B</var>}</code> of them.</span>
                    </p>
                    <p data-if="isSingular(A - B)">We are left with <var>A - B</var> dot.</p>
                    <p data-else="">We are left with <var>A - B</var> dots.</p>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
