<commit_before><!doctype html>
<html lang="en" data-framework="typescript">

<head>
    <meta charset="utf-8">
    <title>MakeCode Runner Test</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
</head>

<body class="ui container">
    <div id='loading' style='font-size: 30px; margin: 100px auto; width: 200px;'>
        loading
        <div style='font-family: Icons;'>...</div>
    </div>

    <style type="text/css">
        @import "./semantic.css";
        @import "./blockly.css";
        @import "./custom.css";
        
        pre {
            white-space: pre-wrap;
        }
.ui[class*="5:3"].embed {
    padding-bottom: 83%;
    background: none;
}        
    </style>
    <script>
        // This line gets patched up by the cloud
        var rootUrl = "dummy";
        var appCdnRoot = "/cdn/";
        var simCdnRoot = "/sim/";
        var simUrl = "/sim/simulator.html";
    </script>

    <script type="text/javascript" src="/blb/marked/marked.min.js"></script>
    <script type="text/javascript" src="/blb/jquery.js"></script>
    <script type="text/javascript" src="/blb/semantic.js"></script>
    <script type="text/javascript" src="/embed.js"></script>
    <script type="text/javascript">
        var ps = [ 
            "0"
/*            
            ,"true"
            ,"false"
            ,"'hello'"
            ,"basic.showNumber(2)"
            ,"basic.showString('Hello!')"
            ,"basic.showNumber(2, 150)"
            ,"while(true) {}"
            ,"if (false) { }",
            ,"if (false) { basic.showNumber(0) } else { basic.clearScreen() }"
            ,"if (false) { basic.showNumber(0) } else if (false) { basic.showNumber(1) } else { basic.clearScreen() }"            
            , "basic.forever(() => { basic.clearScreen(); })"
            , "basic.forever(() => { basic.clearScreen(); basic.showNumber(1); })"
            , "let x = 0;"         
            , "var x = 42\nvar y = 'hello'"   
            , "for(let i = 0;i<5;++i) { basic.clearScreen() }"
            , "radio.onDataReceived(() => {});radio.onDataReceived(() => {});"
            , "var x = 42\nvar y = x"   
            , "input.onButtonPressed(Button.AB, () => {})"
            , "input.onButtonPressed(Button.A, () => {})"
            , "input.onButtonPressed(Button.B, () => {})"
            , "0+1"
            , "0-1"
            , "0*1"
            , "0/1"
            , "(0/1)"
            , "true || (0>1)"
            , "true && (0>1)"
            , "!true"
            ,"basic.showNumber(2); basic.showNumber(2);"
            , "for(let i = 0; i<5;i++) { basic.showNumber(0); basic.showNumber(1);}"
            , "basic.showNumber(1+1); basic.showNumber(0);"
            ,"basic.showLeds(`# # # . .. . . . .. . # . #. # . . ## . . . #`);"
            ,"true && false"
            ,"true || false"
            ,"!true;"
            ,"42 == 0"
            ,"42 != 0"
            ,"42 < 0"
            ,"42 > 0"
            ,"42 <= 0"
            ,"42 >= 0;"
            ,"(false && false) == false"
            ,"(false && true) == false"
            ,"(true && false) == false"
            ,"(true && true) == true;"
            ,"(!false) == true"
            ,"(!true) == false;"
            ,"let x = 0; x = 1;"
            ,"let x = 0; x = x + 1;"
            ,"let x = 0; x++;"
            ,"let x = 0; x--;"
            ,"let x = 0; ++x;"
            ,"let x = 0; --x;"
            ,"let x = 0; -x;"
            ,"let x = 0; +x;"
            ,'basic.forever(() => { let degrees = input.compassHeading(); if (degrees < 45) basic.showString("N"); else if (degrees < 135) basic.showString("E"); else if (degrees < 225) basic.showString("S"); else basic.showString("W"); })'
            ,"let x = 3; x += 3; ++x;"
            ,"-5"
            ,"let roll = 0; if (roll==5) { basic.showNumber(0) } else if (roll==4) { basic.showNumber(1) }"       
            ,"let count = 0; while (count < 10) { basic.pause(100); basic.showNumber(count) }"     
            ,"Math.abs(1)"
            ,"Math.random(4)"            
            ,"input.onGesture(Gesture.Shake, () => { basic.clearScreen(); })"
            , "Math.min(0,1)"
            , "Math.max(0,1)"
            , "input.onButtonPressed(Button.A, () => {}); input.onButtonPressed(Button.B, () => {});" 
            */
           ];
        function next() {
            var p = ps.pop();
            if (!p) return;
            console.log('rendering:')
            console.log(p)
            pxt.runner.decompileToBlocksAsync(p, { emPixels:14, layout: pxt.blocks.BlockLayout.Shuffle }).done(function(r) {
                let svg = r.blocksSvg;
                $('#loading').remove();
                if (svg) {
                    $(svg).removeClass('blocklyPreview')
                    var div = $("<div/>").append(svg)                
                    $(document.body).append(div)                                      
                } else {
                    $(document.body).append($('<pre/>').text('failed to render ' + p))
                    if (r.compileBlocks && r.compileBlocks.diagnostics) {
                        r.compileBlocks.diagnostics.forEach(function(an) {                            
                            $(document.body).append($('<div/>').text(an.messageText))                        
                        })
                    }
                }
                next();
            })
        }
            <commit_msg>Fix random in runner test<commit_after><!doctype html>
<html lang="en" data-framework="typescript">

<head>
    <meta charset="utf-8">
    <title>MakeCode Runner Test</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
</head>

<body class="ui container">
    <div id='loading' style='font-size: 30px; margin: 100px auto; width: 200px;'>
        loading
        <div style='font-family: Icons;'>...</div>
    </div>

    <style type="text/css">
        @import "./semantic.css";
        @import "./blockly.css";
        @import "./custom.css";
        
        pre {
            white-space: pre-wrap;
        }
.ui[class*="5:3"].embed {
    padding-bottom: 83%;
    background: none;
}        
    </style>
    <script>
        // This line gets patched up by the cloud
        var rootUrl = "dummy";
        var appCdnRoot = "/cdn/";
        var simCdnRoot = "/sim/";
        var simUrl = "/sim/simulator.html";
    </script>

    <script type="text/javascript" src="/blb/marked/marked.min.js"></script>
    <script type="text/javascript" src="/blb/jquery.js"></script>
    <script type="text/javascript" src="/blb/semantic.js"></script>
    <script type="text/javascript" src="/embed.js"></script>
    <script type="text/javascript">
        var ps = [ 
            "0"
/*            
            ,"true"
            ,"false"
            ,"'hello'"
            ,"basic.showNumber(2)"
            ,"basic.showString('Hello!')"
            ,"basic.showNumber(2, 150)"
            ,"while(true) {}"
            ,"if (false) { }",
            ,"if (false) { basic.showNumber(0) } else { basic.clearScreen() }"
            ,"if (false) { basic.showNumber(0) } else if (false) { basic.showNumber(1) } else { basic.clearScreen() }"            
            , "basic.forever(() => { basic.clearScreen(); })"
            , "basic.forever(() => { basic.clearScreen(); basic.showNumber(1); })"
            , "let x = 0;"         
            , "var x = 42\nvar y = 'hello'"   
            , "for(let i = 0;i<5;++i) { basic.clearScreen() }"
            , "radio.onDataReceived(() => {});radio.onDataReceived(() => {});"
            , "var x = 42\nvar y = x"   
            , "input.onButtonPressed(Button.AB, () => {})"
            , "input.onButtonPressed(Button.A, () => {})"
            , "input.onButtonPressed(Button.B, () => {})"
            , "0+1"
            , "0-1"
            , "0*1"
            , "0/1"
            , "(0/1)"
            , "true || (0>1)"
            , "true && (0>1)"
            , "!true"
            ,"basic.showNumber(2); basic.showNumber(2);"
            , "for(let i = 0; i<5;i++) { basic.showNumber(0); basic.showNumber(1);}"
            , "basic.showNumber(1+1); basic.showNumber(0);"
            ,"basic.showLeds(`# # # . .. . . . .. . # . #. # . . ## . . . #`);"
            ,"true && false"
            ,"true || false"
            ,"!true;"
            ,"42 == 0"
            ,"42 != 0"
            ,"42 < 0"
            ,"42 > 0"
            ,"42 <= 0"
            ,"42 >= 0;"
            ,"(false && false) == false"
            ,"(false && true) == false"
            ,"(true && false) == false"
            ,"(true && true) == true;"
            ,"(!false) == true"
            ,"(!true) == false;"
            ,"let x = 0; x = 1;"
            ,"let x = 0; x = x + 1;"
            ,"let x = 0; x++;"
            ,"let x = 0; x--;"
            ,"let x = 0; ++x;"
            ,"let x = 0; --x;"
            ,"let x = 0; -x;"
            ,"let x = 0; +x;"
            ,'basic.forever(() => { let degrees = input.compassHeading(); if (degrees < 45) basic.showString("N"); else if (degrees < 135) basic.showString("E"); else if (degrees < 225) basic.showString("S"); else basic.showString("W"); })'
            ,"let x = 3; x += 3; ++x;"
            ,"-5"
            ,"let roll = 0; if (roll==5) { basic.showNumber(0) } else if (roll==4) { basic.showNumber(1) }"       
            ,"let count = 0; while (count < 10) { basic.pause(100); basic.showNumber(count) }"     
            ,"Math.abs(1)"
            ,"Math.random()"            
            ,"input.onGesture(Gesture.Shake, () => { basic.clearScreen(); })"
            , "Math.min(0,1)"
            , "Math.max(0,1)"
            , "input.onButtonPressed(Button.A, () => {}); input.onButtonPressed(Button.B, () => {});" 
            */
           ];
        function next() {
            var p = ps.pop();
            if (!p) return;
            console.log('rendering:')
            console.log(p)
            pxt.runner.decompileToBlocksAsync(p, { emPixels:14, layout: pxt.blocks.BlockLayout.Shuffle }).done(function(r) {
                let svg = r.blocksSvg;
                $('#loading').remove();
                if (svg) {
                    $(svg).removeClass('blocklyPreview')
                    var div = $("<div/>").append(svg)                
                    $(document.body).append(div)                                      
                } else {
                    $(document.body).append($('<pre/>').text('failed to render ' + p))
                    if (r.compileBlocks && r.compileBlocks.diagnostics) {
                        r.compileBlocks.diagnostics.forEach(function(an) {                            
                            $(document.body).append($('<div/>').text(an.messageText))                        
                        })
                    }
                }
                next();
            })
        }
            
{'fraction_non_alphanumeric': 0.19490829455242267, 'fraction_numerical': 0.020348571949995436, 'mean_word_length': 1.4231704620826884, 'pattern_counts': {'":': 0, '<': 77, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '336550', 'n_tokens_mistral': 3510, 'n_tokens_neox': 3348, 'n_words': 640}