<!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>Add within 5</title>
    <script data-main="../local-only/main" src="../local-only/require.js"></script>
</head>
<body>
    <div class="exercise">
        <div class="vars">
            <var id="A">randRange(1, 4)</var>
            <var id="B">randRange(1, 5 - A)</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 + "} + \\green{" + B + "} = {?}}" :
                            "\\Huge{{?} = \\blue{" + A + "} + \\green{" + 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" style="float: left;">
                        drawCircles(A, BLUE);
                    </div>
                    <div class="graphie" style="float: left;">
                        drawCircles(B, GREEN);
                    </div>
                    <p style="clear: left;">
                        <span data-if="isSingular(A)">There is <code>\blue{<var>A</var>}</code> blue dot.</span>
                        <span data-else="">There are <code>\blue{<var>A</var>}</code> blue dots.</span>
                        <span data-if="isSingular(B)">There is <code>\green{<var>B</var>}</code> green dot.</span>
                        <span data-else="">There are <code>\green{<var>B</var>}</code> green dots.</span>
                    </p>
                    <p>There are a total of <var>A + B</var> dots.</p>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
