<commit_before>(function() {

var stage;
var tikis; // save all canvas objects of tikis

var canvasWidth = 0, canvasHeight = 0;
var tikiWidth = 0, tikiHeight = 0;
var tikiColor = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728',
    '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22'];

var selectedTikiIdx;
var hasSelected; // Boolean
var selectMark;

var upCardRemain, killCardRemain;

$(document).ready(function() {
    initDOMElement();

    initParams();
    displayResult($('#result-area'), [16, 9], 2)

    createCanvasStage();
    createCards();
    setupOthers();

    setupAnimVar();

    startGame();
    $('#tabs').find('li:nth-child(2) a').click();
});



function agentPk() {
    var configDiv = $('#test-wrapper #config-div');
    var iter = configDiv.find('input')[0].value;
    if (isNaN(iter)) {
        alert('Iterations value invalid.');
        configDiv.find('input')[0].value = '';
        return;
    }

    var agentOptions = configDiv.find('option');
    var agents = {};
    for (var i = 0; i < agentOptions.length; ++i) {
        var agentName = agentOptions[i].value;
        agents.agentName = new Agent(agentName);
    }
    
    var resultArea = $('#result-area').html('');
    for (var i = 0; i < iter; ++i) {
        while(1) {
            for (var key in agents) {
                agents[key].move();
            }
            var endingResult = askJudge();
            if (null !== endingResult) {
                dislayResult(resultArea, endingResult, i);
                break;
            }
        }
    }
}

function displayResult(area, results, iter) {
    area.html(function(idx, oldhtml) {
        var content = '<span>Iter&nbsp;#' + iter + '</span></br>';
        for (var i = 0; i < results.length; i++) {
            content += '<span>Agent&nbsp;' + i + '&nbsp;score:&nbsp;'
                             + results[i] + '</span>';
        };
        return oldhtml + content + '</br>';
    })
}
<commit_msg>pass idx to new Agent<commit_after>(function() {

var stage;
var tikis; // save all canvas objects of tikis

var canvasWidth = 0, canvasHeight = 0;
var tikiWidth = 0, tikiHeight = 0;
var tikiColor = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728',
    '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22'];

var selectedTikiIdx;
var hasSelected; // Boolean
var selectMark;

var upCardRemain, killCardRemain;

$(document).ready(function() {
    initDOMElement();

    initParams();
    displayResult($('#result-area'), [16, 9], 2)

    createCanvasStage();
    createCards();
    setupOthers();

    setupAnimVar();

    startGame();
    $('#tabs').find('li:nth-child(2) a').click();
});



function agentPk() {
    var configDiv = $('#test-wrapper #config-div');
    var iter = configDiv.find('input')[0].value;
    if (isNaN(iter)) {
        alert('Iterations value invalid.');
        configDiv.find('input')[0].value = '';
        return;
    }

    var agentOptions = configDiv.find('option');
    var agents = {};
    for (var i = 0; i < agentOptions.length; ++i) {
        var agentName = agentOptions[i].value;
        agents[agentName] = new Agent(agentName, i);
    }
    
    var resultArea = $('#result-area').html('');
    for (var i = 0; i < iter; ++i) {
        while(1) {
            for (var key in agents) {
                agents[key].move();
            }
            var endingResult = askJudge();
            if (null !== endingResult) {
                dislayResult(resultArea, endingResult, i);
                break;
            }
        }
    }
}

function displayResult(area, results, iter) {
    area.html(function(idx, oldhtml) {
        var content = '<span>Iter&nbsp;#' + iter + '</span></br>';
        for (var i = 0; i < results.length; i++) {
            content += '<span>Agent&nbsp;' + i + '&nbsp;score:&nbsp;'
                             + results[i] + '</span>';
        };
        return oldhtml + content + '</br>';
    })
}

{'fraction_non_alphanumeric': 0.17782319877363312, 'fraction_numerical': 0.02350536535513541, 'mean_word_length': 2.3605150214592276, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 15, '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': '4897146', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1261, 'n_words': 295}