<commit_before>Math.radians = function(degrees) {
    return degrees * Math.PI / 180;
}

Math.degrees = function(radians) {
    return radians * 180 / Math.PI;
}

function areEqualVectors(v1, v2) {
    return v1.rho === v2.rho && v1.theta === v2.theta && v1.phi === v2.phi;
}

function convertToCartesian(rho, theta, phi) {
    var x = rho * Math.cos(Math.radians(theta)) * Math.sin(Math.radians(phi));
    var y = rho * Math.sin(Math.radians(theta)) * Math.sin(Math.radians(phi));
    var z = rho * Math.cos(Math.radians(phi));
    return {x: x, y: y, z: z};
}

function convertToCantor(rho, theta, phi) {
    var a = toCantor(rho, theta);
    var b = toCantor(theta, phi);
    var c = toCantor(phi, rho);
    return {a: a, b: b, c: c};
}

// Converts formula output given by engineer to a 3D vector
function convertToVector(a, b, c) {
    var rho = invertCantor(a).x;
    var theta = invertCantor(b).x;
    var phi = invertCantor(c).x;
    return {rho: rho, theta: theta, phi: phi};
}

function toCantor(x, y) {
    return ((x+y) * (x+y+1)) / 2 + y;
}

// Inverts the Cantor pairing function
function invertCantor(z) {
    var w = Math.floor((Math.sqrt(8*z+1)-1) / 2);
    var t = (Math.pow(w, 2) + w) / 2;
    var y = z - t;
    var x = w - y;
    return {x: x, y: y};
}

function checkAnswer(target, answer) {
    var estimatedVector = convertToVector(answer.a, answer.b, answer.c);
    if (areEqualVectors(estimatedVector, target)) {
        console.log("YOU WIN!");
        MissionLink.unsync();
    }
    else {
        var cartesian = convertToCartesian(estimatedVector.rho, estimatedVector.theta, estimatedVector.phi);
        console.log('Drawing red: ', cartesian.x, ' ', cartesian.y, ' ', cartesian.z);
    }
}

function run() {
    var target = {
        rho: Math.floor(Math.random() * 100),
        theta: Math.floor(Math.random() * 360),
        phi: Math.floor(Math.random() * 180)
    }

    var cartesian = convertToCartesian(target.rho, target.theta, target.phi);
    //drawBaseVector()
    console.log('Drawing black: ', cartesian.x, ' ', cartesian.y, ' ', cartesian.z);

    var answer = {
        a: undefined,
        b: undefined,
        c: undefined
    }

    var currentInputNumber = 0;

    MissionLink.sync();

    MissionLink.alphaCallback = function(data) {
        currentInputNumber += 1;
    }

    MissionLink.betaCallback = function(data) {
        currentInputNumber *= 10;
    }

    MissionLink.gammaCallback = function(data) {
        if (answer.a === undefined) {<commit_msg>Reduced possible vectors<commit_after>Math.radians = function(degrees) {
    return degrees * Math.PI / 180;
}

Math.degrees = function(radians) {
    return radians * 180 / Math.PI;
}

function areEqualVectors(v1, v2) {
    return v1.rho === v2.rho && v1.theta === v2.theta && v1.phi === v2.phi;
}

function convertToCartesian(rho, theta, phi) {
    var x = rho * Math.cos(Math.radians(theta)) * Math.sin(Math.radians(phi));
    var y = rho * Math.sin(Math.radians(theta)) * Math.sin(Math.radians(phi));
    var z = rho * Math.cos(Math.radians(phi));
    return {x: x, y: y, z: z};
}

function convertToCantor(rho, theta, phi) {
    var a = toCantor(rho, theta / 10);
    var b = toCantor(theta / 10, phi / 10);
    var c = toCantor(phi / 10, rho);
    return {a: a, b: b, c: c};
}

// Converts formula output given by engineer to a 3D vector
function convertToVector(a, b, c) {
    var rho = invertCantor(a).x;
    var theta = invertCantor(b).x * 10;
    var phi = invertCantor(c).x * 10;
    return {rho: rho, theta: theta, phi: phi};
}

function toCantor(x, y) {
    return ((x+y) * (x+y+1)) / 2 + y;
}

// Inverts the Cantor pairing function
function invertCantor(z) {
    var w = Math.floor((Math.sqrt(8*z+1)-1) / 2);
    var t = (Math.pow(w, 2) + w) / 2;
    var y = z - t;
    var x = w - y;
    return {x: x, y: y};
}

function checkAnswer(target, answer) {
    var estimatedVector = convertToVector(answer.a, answer.b, answer.c);
    if (areEqualVectors(estimatedVector, target)) {
        console.log("YOU WIN!");
        MissionLink.unsync();
    }
    else {
        var cartesian = convertToCartesian(estimatedVector.rho, estimatedVector.theta, estimatedVector.phi);
        console.log('Drawing red: ', cartesian.x, ' ', cartesian.y, ' ', cartesian.z);
    }
}

function run() {
    var target = {
        rho: Math.floor(Math.random() * 25),
        theta: Math.floor(Math.random() * 36) * 10,
        phi: Math.floor(Math.random() * 18) * 10
    }

    console.log(target);

    var cartesian = convertToCartesian(target.rho, target.theta, target.phi);
    //drawBaseVector()
    console.log('Drawing black: ', cartesian.x, ' ', cartesian.y, ' ', cartesian.z);

    var answer = {
        a: undefined,
        b: undefined,
        c: undefined
    }

    var currentInputNumber = 0;

    MissionLink.sync();

    MissionLink.alphaCallback = function(data) {
        currentInputNumber += 1;
    }

    MissionLink.betaCallback = function(data) {
        currentInputNumber *= 10;
    }

    MissionLink.gammaCallback = function(data) {
        if (answer.a === undefined) {
{'fraction_non_alphanumeric': 0.15616438356164383, 'fraction_numerical': 0.016634050880626222, 'mean_word_length': 2.7971768202080236, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6684918', 'n_tokens_mistral': 1933, 'n_tokens_neox': 1832, 'n_words': 435}