<commit_before>(function (window, document) {

var slice = [].slice, dToR = Math.PI / 180, define;

function makeFn(args, fn) {
    return Function(
        args.concat('__canvas,__canvasElement,__turtle,__args,__extras').join(','),
        'return (' + fn + ').apply(this, __extras.concat(__args))'
    );
}

function turtleGraphics(canvas, draw) {
    if (typeof canvas == 'string')
        canvas = document.querySelector(canvas);
    var turtle = {
        x: 0,
        y: 0,
        heading: 0,
        drawing: true
    },  context = canvas.getContext('2d'),
        keys = Object.keys(turtleGraphics.functions),
        values = keys.map(function (key) { return turtleGraphics.functions[key]; }).map(function (fn) {
            var fun = makeFn(keys, fn.fn);
            return function () {
                return fun.apply(this, args(arguments, fn.args));
            };
        }), returnVal;
    function args(args, extras) {
        return values.concat(context, canvas, turtle, [slice.call(args)], [extras]);
    }
    context.beginPath();
    context.moveTo(turtle.x, turtle.y);
    returnVal = makeFn(keys, draw).apply(this, args(arguments, []));
    context.stroke();
    context.closePath();
    return returnVal;
}

turtleGraphics.functions = {};
define = turtleGraphics.define = function (name, fn, args) {
    turtleGraphics.functions[name] = {fn: fn, args: (args || []).concat(fn.args || [])};
};

define('penup', function () {
    __turtle.drawing = false;
});

define('pendown', function () {
    __turtle.drawing = true;<commit_msg>add functions to get and set the line color<commit_after>(function (window, document) {

var slice = [].slice, dToR = Math.PI / 180, define;

function makeFn(args, fn) {
    return Function(
        args.concat('__canvas,__canvasElement,__turtle,__args,__extras').join(','),
        'return (' + fn + ').apply(this, __extras.concat(__args))'
    );
}

function turtleGraphics(canvas, draw) {
    if (typeof canvas == 'string')
        canvas = document.querySelector(canvas);
    var turtle = {
        x: 0,
        y: 0,
        heading: 0,
        drawing: true
    },  context = canvas.getContext('2d'),
        keys = Object.keys(turtleGraphics.functions),
        values = keys.map(function (key) { return turtleGraphics.functions[key]; }).map(function (fn) {
            var fun = makeFn(keys, fn.fn);
            return function () {
                return fun.apply(this, args(arguments, fn.args));
            };
        }), returnVal;
    function args(args, extras) {
        return values.concat(context, canvas, turtle, [slice.call(args)], [extras]);
    }
    context.beginPath();
    context.moveTo(turtle.x, turtle.y);
    returnVal = makeFn(keys, draw).apply(this, args(arguments, []));
    context.stroke();
    context.closePath();
    return returnVal;
}

turtleGraphics.functions = {};
define = turtleGraphics.define = function (name, fn, args) {
    turtleGraphics.functions[name] = {fn: fn, args: (args || []).concat(fn.args || [])};
};

define('penup', function () {
    __turtle.drawing = false;
});

define('pendown', function () {
    __turtle.drawing = true;
});

define('color', function () {
    return __canvas.strokeStyle;
});

define('setcolor', function (color) {
    __canvas.strokeStyle = color;
{'fraction_non_alphanumeric': 0.16205533596837945, 'fraction_numerical': 0.004256612952265126, 'mean_word_length': 3.002433090024331, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4700819', 'n_tokens_mistral': 1063, 'n_tokens_neox': 1011, 'n_words': 220}