<commit_before><html>
<script type="text/javascript">
var wouldWinIfSwitch = 0;
var wouldLoseIfSwitch = 0;
var gameQty = 0;
function runGame() {
    var prizeDoor = Math.round(3 * Math.random());
    var guessDoor = Math.round(3 * Math.random());
    var firstGuessIsRight = (guessDoor === prizeDoor);
    
    if ( firstGuessIsRight ) {
        ++wouldLoseIfSwitch;
    } else {
        ++wouldWinIfSwitch;
    }
    
    ++gameQty;
}

var CELL_WIDTH = 400;
function updateUi() {
    var wouldWinIfSwitchPercent = wouldWinIfSwitch / gameQty;
    var wouldLoseIfSwitchPercent = wouldLoseIfSwitch / gameQty;
    
    var switchingWinsWidth = Math.round(CELL_WIDTH * wouldWinIfSwitchPercent);
    var switchingLosesWidth = Math.round(CELL_WIDTH * wouldLoseIfSwitchPercent);
    
    document.getElementById('switching-wins-left').style.width = switchingWinsWidth + "px";
    document.getElementById('switching-wins-right').style.width = (CELL_WIDTH - switchingWinsWidth) + "px";
    document.getElementById('switching-loses-left').style.width = switchingLosesWidth + "px";
    document.getElementById('switching-loses-right').style.width = (CELL_WIDTH - switchingLosesWidth) + "px";
    
    document.getElementById('game-qty').innerText = gameQty;
    document.getElementById('win-if-switch').innerText = wouldWinIfSwitch + " - " + Math.round(wouldWinIfSwitchPercent * 100) + "%";
    document.getElementById('lose-if-switch').innerText = wouldLoseIfSwitch + " - " + Math.round(wouldLoseIfSwitchPercent * 100) + "%";
}

function runSimulation() {
    runGame();
    updateUi();
}
</script>

<body style="font-size: 14px;">
<h1 style="text-align: center;">Monty Hall Simulation</h1>

<div style="width: 600px; height: 16px; border: 1px solid black;">
    <div style="float: left; width: 150px;">Switching Wins: </div>
    <div id="switching-wins-left" style="float: left; background-color: green;">&nbsp;</div>
    <div id="switching-wins-right" style="float: left;">&nbsp;</div>
</div>

<div style="width: 600px; height: 16px; border: 1px solid black;">
    <div style="float: left; width: 150px;">Switching Loses: </div>
    <div id="switching-loses-left" style="float: left; background-color: red;">&nbsp;</div>
    <div id="switching-loses-right" style="float: left;">&nbsp;</div>
</div>

<ul style="clear: both;">
    <li>Game qty: <span id="game-qty"></span></li>
    <li>Would win if switch: <span id="win-if-switch"></span></li>
    <li>Would lose if switch: <span id="lose-if-switch"></span></li>
</ul>

<h3 style="text-align: center;"><a href="https://gist.github.com/Randgalt/9bd1de087d40b7ee9b10f2e6fec728e8">View the code</a></h3>

</body>

<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
   setInterval(runSimulation, 100);
});
</script>

</html><commit_msg>Add speed buttons<commit_after><html>
<head>
    <style>
        #button-fast, #button-normal, #button-slow {
            border: 1px solid black;
            padding: 3px;
            display: inline;
            cursor: pointer;
        }
        
        #container-for-buttons {
            margin-bottom: 25px;
        }
    </style>
</head>
<script type="text/javascript">
var wouldWinIfSwitch = 0;
var wouldLoseIfSwitch = 0;
var gameQty = 0;
var speed = 10;
function runGame() {
    var prizeDoor = Math.round(3 * Math.random());
    var guessDoor = Math.round(3 * Math.random());
    var firstGuessIsRight = (guessDoor === prizeDoor);
    
    if ( firstGuessIsRight ) {
        ++wouldLoseIfSwitch;
    } else {
        ++wouldWinIfSwitch;
    }
    
    ++gameQty;
}

var CELL_WIDTH = 400;
function updateUi() {
    var wouldWinIfSwitchPercent = wouldWinIfSwitch / gameQty;
    var wouldLoseIfSwitchPercent = wouldLoseIfSwitch / gameQty;
    
    var switchingWinsWidth = Math.round(CELL_WIDTH * wouldWinIfSwitchPercent);
    var switchingLosesWidth = Math.round(CELL_WIDTH * wouldLoseIfSwitchPercent);
    
    document.getElementById('switching-wins-left').style.width = switchingWinsWidth + "px";
    document.getElementById('switching-wins-right').style.width = (CELL_WIDTH - switchingWinsWidth) + "px";
    document.getElementById('switching-loses-left').style.width = switchingLosesWidth + "px";
    document.getElementById('switching-loses-right').style.width = (CELL_WIDTH - switchingLosesWidth) + "px";
    
    document.getElementById('game-qty').innerText = gameQty;
    document.getElementById('win-if-switch').innerText = wouldWinIfSwitch + " - " + Math.round(wouldWinIfSwitchPercent * 100) + "%";
    document.getElementById('lose-if-switch').innerText = wouldLoseIfSwitch + " - " + Math.round(wouldLoseIfSwitchPercent * 100) + "%";
}

function runSimulation() {
    runGame();
    updateUi();
    setTimeout(runSimulation, speed);
}
</script>

<body style="font-size: 14px;">
<h1 style="text-align: center;">Monty Hall Simulation</h1>

<div id="container-for-buttons">
    <div id="button-fast">Fast</div>
    <div id="button-normal">Normal</div>
    <div id="button-slow">Slow</div>
</div>

<div style="width: 600px; height: 16px; border: 1px solid black;">
    <div style="float: left; width: 150px;">Switching Wins: </div>
    <div id="switching-wins-left" style="float: left; background-color: green;">&nbsp;</div>
    <div id="switching-wins-right" style="float: left;">&nbsp;</div>
</div>

<div style="width: 600px; height: 16px; border: 1px solid black;">
    <div style="float: left; width: 150px;">Switching Loses: </div>
    <div id="switching-loses-left" style="float: left; background-color: red;">&nbsp;</div>
    <div id="switching-loses-right" style="float: left;">&nbsp;</div>
</div>

<ul style="clear: both;">
    <li>Game qty: <span id="game-qty"></span></li>
    <li>Would win if switch: <span id="win-if-switch"></span></li>
    <li>Would lose if switch: <span id="lose-if-switch"></span></li>
</ul>

<h3 style="text-align: center;"><a href="https://gist.github.com/Randgalt/9bd1de087d40b7ee9b10f2e6fec728e8">View the code</a></h3>

</body>

<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
    document.getElementById('button-fast').addEventListener('click', function(){
        speed = 10;
    });
    document.getElementById('button-normal').addEventListener('click', function(){
        speed = 100;
    });
    document.getElementById('button-slow').addEventListener('click', function(){
        speed = 1500;
    });
    
    setTimeout(runSimulation, speed);
});
</script>

</html>
{'fraction_non_alphanumeric': 0.16733436055469955, 'fraction_numerical': 0.019722650231124808, 'mean_word_length': 4.094976452119309, 'pattern_counts': {'":': 0, '<': 103, '<?xml version=': 0, '>': 103, 'https://': 2, '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': '3563866', 'n_tokens_mistral': 2255, 'n_tokens_neox': 2130, 'n_words': 405}