<commit_before><!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title> Botler </title>

    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>

    
    <link rel="stylesheet" href="/static/css/bootstrap.min.css" type="text/css">
    <link rel="stylesheet" href="/static/font-awesome/css/font-awesome.min.css" type="text/css">
    <link rel="stylesheet" href="/static/css/animate.min.css" type="text/css">
    <link rel="stylesheet" href="/static/css/creative.css" type="text/css">
    <link rel="stylesheet" href="/static/css/monokai.css" type="text/css">

	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>

    
     
    <!-- CodeMirror and its JavaScript mode file -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.2.0/codemirror.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.2.0/mode/javascript/javascript.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.2.0/codemirror.css" />

    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js"></script>
    <script src="/static/js/elastic-progress.min.js"></script>
    <script type="text/javascript" src="/static/js/python.js"></script>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js">
     $(function() {

$('.Upload').ElasticProgress({/*options*/});

             });
        </script>
</head>

<body id="page-top">
    <nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand page-scroll" href="/">Botler Home</a>
            </div>  
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>

    <section class="bg-primary">
       <div class="col-lg-8 col-lg-offset-2 text-center" id="gamescreen">

       </div>
    </section>  

   <section class="bg-primary" id = "abouttbhlol" style="height:2000px">
        <form action="/script_upload" id="script_uploader", method="POST">
            <div class="container" >
                <div class="row">
                    <div class="col-lg-8 col-lg-offset-2 text-center">
                        <h2 class="section-heading">Play Now</h2>
                        <hr class="light">
                        <p class="text-faded"> Welcome to the Botler IDE; the barracks before you release your code into battle.</p>
                        <br><br>
                        <p class="text-faded"> Below is an IDE for Botler. Tailored for Python, it allows you to write your code online, and test it too!</p>
                        <br><br>

                        <h3 class="section-heading">IMPORTANT</h3>
                        <p class="text-faded"> If you don't know how to format your python file, see the <a href="/docs" style="color:#FFFFFF">docs</a> </p>
                        <br><br>
                    </div>
                    <br><br><br><br><br><br><br>
                    <br><br><br><br><br><br><br>
                    <br><br><br><br><br><br><br>
                    <div class="fluid_container">
                        <div class="ide_container">
                            <textarea id="code" name="code" cols="120" rows="30" form="script_uploader">
#My awesome bot that plays games

from random import choice

def main(data):
    return choice(data['valid_moves'])
                            </textarea>
                            <br>
                            <input name="script_name" type="text" class="form-control" id="script_name" placeholder="Script Name">
                            <br>
                            <select name="game" id="game_select" form="script_uploader" class="form-control">
                              <option value="rps">Rock Paper Scissors</option>
                              <option value="tron">Light Cycle</option>
                            </select>

                        </div>
                        <button type="submit" class="btn btn-primary btn-xl page-scroll prog_submit1" id="upload-file" style="margin-left:515px;">Upload File</button>
                        <br><br><br>
                        <a id="runsim" class="btn btn-primary btn-xl page-scroll prog_submit1" style="margin-left:530px;">Run Sim</a>
                    </div> 
                    

<!--                     <submit class = "">  </submit>
                    <submit onclick = "prompt_submit()" class= "btn btn-primary btn-xl page-scroll prog_submit2"> Use this program </submit>
 -->                </div>
            </div>


        </form>
    </section>  

    <script>

        var socket = io.connect('http://' + document.domain + ':' + location.port);
        socket.on('connect', function() {
            document.getElementById("runsim").onclick = function(){
                alert($('#game_select').val())
                socket.emit('simstart', { script_name: $('#script_name').val(), game_name: $('#game_select').val() });    
            }
            // $("#runsim").on('click', function(e){
            // })
            
        });
        svgbuff = []
        socket.on('frame', function(msg){
            svgbuff.push(msg['data'])

        })

        socket.on('seqend', function(){
            console.log("yo")
            i = 0
            function ren(){
                console.log("running")
                $("#gamescreen").html(svgbuff[i]);
                i++
                setTimeout(function(){
                    ren()
                },100)
            }
            ren()
            // for(svg in svgbuff){
                // console.log("SVG", svgbuff[svg])
                // $("#gamescreen").html(svgbuff[svg]);

            // }
            
        })






        $("#script_uploader").submit(function() {<commit_msg>Hacks to make things work smoothly.<commit_after><!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title> Botler </title>

    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>

    
    <link rel="stylesheet" href="/static/css/bootstrap.min.css" type="text/css">
    <link rel="stylesheet" href="/static/font-awesome/css/font-awesome.min.css" type="text/css">
    <link rel="stylesheet" href="/static/css/animate.min.css" type="text/css">
    <link rel="stylesheet" href="/static/css/creative.css" type="text/css">
    <link rel="stylesheet" href="/static/css/monokai.css" type="text/css">

	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>

    
     
    <!-- CodeMirror and its JavaScript mode file -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.2.0/codemirror.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.2.0/mode/javascript/javascript.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.2.0/codemirror.css" />

    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js"></script>
    <script src="/static/js/elastic-progress.min.js"></script>
    <script type="text/javascript" src="/static/js/python.js"></script>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js">
     $(function() {

$('.Upload').ElasticProgress({/*options*/});

             });
        </script>
</head>

<body id="page-top">
    <nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand page-scroll" href="/">Botler Home</a>
            </div>  
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>

    <section class="bg-primary">
       <div class="col-lg-8 col-lg-offset-2 text-center" id="gamescreen">

       </div>
    </section>  

   <section class="bg-primary" id = "abouttbhlol" style="height:2000px">
        <form action="/script_upload" id="script_uploader", method="POST">
            <div class="container" >
                <div class="row">
                    <div class="col-lg-8 col-lg-offset-2 text-center">
                        <h2 class="section-heading">Play Now</h2>
                        <hr class="light">
                        <p class="text-faded"> Welcome to the Botler IDE; the barracks before you release your code into battle.</p>
                        <br><br>
                        <p class="text-faded"> Below is an IDE for Botler. Tailored for Python, it allows you to write your code online, and test it too!</p>
                        <br><br>

                        <h3 class="section-heading">IMPORTANT</h3>
                        <p class="text-faded"> If you don't know how to format your python file, see the <a href="/docs" style="color:#FFFFFF">docs</a> </p>
                        <br><br>
                    </div>
                    <br><br><br><br><br><br><br>
                    <br><br><br><br><br><br><br>
                    <br><br><br><br><br><br><br>
                    <div class="fluid_container">
                        <div class="ide_container">
                            <textarea id="code" name="code" cols="120" rows="30" form="script_uploader">
#My awesome bot that plays games

from random import choice

def main(data):
    return choice(data['valid_moves'])
                            </textarea>
                            <br>
                            <input name="script_name" type="text" class="form-control" id="script_name" placeholder="Script Name">
                            <br>
                            <select name="game" id="game_select" form="script_uploader" class="form-control">
                              <option value="rps">Rock Paper Scissors</option>
                              <option value="tron">Light Cycle</option>
                            </select>

                        </div>
                        <button type="submit" class="btn btn-primary btn-xl page-scroll prog_submit1" id="upload-file" style="margin-left:515px;">Upload File</button>
                        <br><br><br>
                        <a id="runsim" class="btn btn-primary btn-xl page-scroll prog_submit1" style="margin-left:530px;">Run Sim</a>
                    </div> 
                    

<!--                     <submit class = "">  </submit>
                    <submit onclick = "prompt_submit()" class= "btn btn-primary btn-xl page-scroll prog_submit2"> Use this program </submit>
 -->                </div>
            </div>


        </form>
    </section>  

    <script>
        function hackyTrigger(socket) {
            socket.emit('simstart', { script_name: 'random', game_name: 'tron' });    
        }

        var socket = io.connect('http://' + document.domain + ':' + location.port);
        socket.on('connect', function() {
            document.getElementById("runsim").onclick = function(){
                // alert($('#game_select').val())
                socket.emit('simstart', { script_name: $('#script_name').val(), game_name: $('#game_select').val() });    
            }
            hackyTrigger(socket);
            // $("#runsim").on('click', function(e){
            // })
            
        });
        svgbuff = []
        socket.on('frame', function(msg){
            svgbuff.push(msg['data'])

        })

        socket.on('seqend', function(){
            console.log("yo")
            i = 0
            function ren(){
                console.log("running")
                $("#gamescreen").html(svgbuff[i]);
                i++
                setTimeout(function(){
                    ren()
                },100)
            }
            ren()
            hackyTrigger(socket);
            // for(svg in svgbuff){
                // console.log("SVG", svgbuff[svg])
                // $("#gamescreen").html(svgbuff[svg]);

            // }
            
        })






        $("#script_uploader").submit(function() {
{'fraction_non_alphanumeric': 0.1685868961687951, 'fraction_numerical': 0.01526929483620211, 'mean_word_length': 1.8980289621882542, 'pattern_counts': {'":': 0, '<': 287, '<?xml version=': 0, '>': 287, 'https://': 12, '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': '613116', 'n_tokens_mistral': 4450, 'n_tokens_neox': 4094, 'n_words': 736}