<commit_before>$(function () {

    var $renderer = $("#renderer");
    var $codeEditor = $("#karel-code-editor");
    var $mapSelectionList = $("#world-list-tab");
    var $languageList = $("#language-list");
    var $code = $('.karel-code-editor-code-area');
    var $speedSlider = $('#speed-slider');

    var renderer = '3D';
    var language = 'js';

    var map = {
        name: 'some map name',
        original: {
            map:[
                ['x', '', '', 3, '', 2, 3],
                ['x', '', 4, 3, 'x', 1, ''],
                ['', '', 'x', 1, 'x', '', ''],
                ['', 'x', 3, 'x', 2, '', 5],
                ['', 'x', '', 1, 'x', 'x', ''],
                [2,  '',   1, 3, 'x', 'x', ''],
                ['x', '', 'x', 3, '', 1, '']
            ],
            karel: {
                position: [0, 5],
                direction: 1,
                beepers: 1000
            }
        },
        final:  [{
            map:[
                ['x', '', '', 3, '', 2, 3],
                ['x', '', 4, 3, 'x', 1, ''],
                ['', '', 'x', 1, 'x', '', ''],
                ['', 'x', 1, 'x', 2, '', 5],
                ['', 'x', 1, 1, 'x', 'x', ''],
                [1, 1, 1, 1, 'x', 'x', ''],
                ['x', '', 'x', 3, '', 1, '']
            ],
            karel: {
                position: [0, 5],
                direction: 1
            }
        }],
        description: 'problem solving'
    };

    var greetingsMove = [
        { command: 'rotate', data: {angle: -1} },
        { command: 'rotate', data: {angle: 1} }
    ];
    var karelPlayer = null;

    preparePlayer(map);

    var karelCodeEditor = new KarelCodeEditor($codeEditor);
    var karelMapSelector = new MapSelector($mapSelectionList);
    var sidebarManager = new SidebarSlider($('#code-editor-tab'));

    var karelMapEditor = null;
    var compileResults = null;
    var playState = true;

    karelCodeEditor.onCodeSubmit(onCodeSubmit);
    karelMapSelector.onChange(preparePlayer);
    karelMapSelector.formUlList();

    function preparePlayer(newMap, forceRenderer) {
        $renderer.html('');
        forceRenderer = forceRenderer || renderer;
        if(map!=newMap){ // detect map changing
            map=newMap; // for compliler
        }
        karelPlayer = new KarelPlayer($renderer, newMap.original, forceRenderer);
        karelPlayer.play(greetingsMove, null);
    }

    function onCodeSubmit() {
        karelPlayer.resume();
        karelCodeEditor.editor.setOption("fullScreen", false);
        playState = true;
        $('#play-pause-btn > .button').css('background-image', 'url("img/controls/pause.svg")');
        var code = karelCodeEditor.getCode();
        console.log(code);
        var data = KarelCodeCompiler.compile(code, map, language);
        compileResults = data.result;
        karelPlayer.play(data.commands, onPlayerFinish);<commit_msg>adds redirect on the code editor after choosing map<commit_after>$(function () {

    var $renderer = $("#renderer");
    var $codeEditor = $("#karel-code-editor");
    var $mapSelectionList = $("#world-list-tab");
    var $languageList = $("#language-list");
    var $code = $('.karel-code-editor-code-area');
    var $speedSlider = $('#speed-slider');

    var renderer = '3D';
    var language = 'js';

    var map = {
        name: 'some map name',
        original: {
            map:[
                ['x', '', '', 3, '', 2, 3],
                ['x', '', 4, 3, 'x', 1, ''],
                ['', '', 'x', 1, 'x', '', ''],
                ['', 'x', 3, 'x', 2, '', 5],
                ['', 'x', '', 1, 'x', 'x', ''],
                [2,  '',   1, 3, 'x', 'x', ''],
                ['x', '', 'x', 3, '', 1, '']
            ],
            karel: {
                position: [0, 5],
                direction: 1,
                beepers: 1000
            }
        },
        final:  [{
            map:[
                ['x', '', '', 3, '', 2, 3],
                ['x', '', 4, 3, 'x', 1, ''],
                ['', '', 'x', 1, 'x', '', ''],
                ['', 'x', 1, 'x', 2, '', 5],
                ['', 'x', 1, 1, 'x', 'x', ''],
                [1, 1, 1, 1, 'x', 'x', ''],
                ['x', '', 'x', 3, '', 1, '']
            ],
            karel: {
                position: [0, 5],
                direction: 1
            }
        }],
        description: 'problem solving'
    };

    var greetingsMove = [
        { command: 'rotate', data: {angle: -1} },
        { command: 'rotate', data: {angle: 1} }
    ];
    var karelPlayer = null;

    preparePlayer(map);

    var karelCodeEditor = new KarelCodeEditor($codeEditor);
    var karelMapSelector = new MapSelector($mapSelectionList);
    var sidebarManager = new SidebarSlider($('#code-editor-tab'));

    var karelMapEditor = null;
    var compileResults = null;
    var playState = true;

    karelCodeEditor.onCodeSubmit(onCodeSubmit);
    karelMapSelector.onChange(preparePlayer);
    karelMapSelector.formUlList();

    function preparePlayer(newMap, forceRenderer) {
        $renderer.html('');
        forceRenderer = forceRenderer || renderer;
        if(map!=newMap){ // detect map changing
            map=newMap; // for compliler
        }
        karelPlayer = new KarelPlayer($renderer, newMap.original, forceRenderer);
        karelPlayer.play(greetingsMove, null);
        $("#code-btn").trigger('click');
        $.featherlight($('<div>Current task:<br><br>'+map.description+'</div>'), {});
    }

    function onCodeSubmit() {
        karelPlayer.resume();
        karelCodeEditor.editor.setOption("fullScreen", false);
        playState = true;
        $('#play-pause-btn > .button').css('background-image', 'url("img/controls/pause.svg")');
        var code = karelCodeEditor.getCode();
        console.log(code);
        var data = KarelCodeCompiler.compile(code, map, language);
        compileResults = data.result;
        karelPlayer.play(data.commands, onPlayerFinish);
{'fraction_non_alphanumeric': 0.1955026011075684, 'fraction_numerical': 0.015774458801812385, 'mean_word_length': 1.821969696969697, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '851506', 'n_tokens_mistral': 1938, 'n_tokens_neox': 1803, 'n_words': 406}