<commit_before>package com.github.forhacks.evolve2048;

import java.util.List;

public class AndNeuron extends Neuron {

    private static final double MAX_CHANGE = 1;
    private static final double ADD_PROB = 0.05;

    public AndNeuron(List<Integer> parents, Layer prev) {
        super(parents, prev);
    }

    public AndNeuron(List<Integer> parents, Layer prev, double up, double left, double down, double right) {
        super(parents, prev);
        this.up = up;
        this.left = left;
        this.down = down;
        this.right = right;
    }

    @Override
    public void mutate(Layer prev) {

        up += Math.random() * 2 * MAX_CHANGE - MAX_CHANGE;
        left += Math.random() * 2 * MAX_CHANGE - MAX_CHANGE;
        down += Math.random() * 2 * MAX_CHANGE - MAX_CHANGE;
        right += Math.random() * 2 * MAX_CHANGE - MAX_CHANGE;

        if (Math.random() < ADD_PROB) {

            int n1 = (int) (Math.random() * prev.neurons.size());
            int n2 = (int) (Math.random() * prev.neurons.size());
            while (n2 == n1) {
                n2 = (int) (Math.random() * prev.neurons.size());
            }

            parents.add(n1);
            parents.add(n2);

        }
    }

    public double[] getData() {

        _up = up; _left = left; _down = down; _right = right;

        int i = parents.size();

        Neuron parent1 = prev.neurons.get(parents.get(i - 2));
        Neuron parent2 = prev.neurons.get(parents.get(i - 1));

        double[] data1 = parent1.getData();
        double[] data2 = parent2.getData();

        _value = Math.abs(data1[0] - data2[0]);

        _up += (data1[1] + data2[1])/2;
        _left += (data1[2] + data2[2])/2;
        _down += (data1[3] + data2[3])/2;
        _right += (data1[4] + data2[4])/2;

        return new double[] {_value, _up, _left, _down, _right};

    }

}<commit_msg>Changed And<commit_after>package com.github.forhacks.evolve2048;

import java.util.List;

public class AndNeuron extends Neuron {

    private static final double MAX_CHANGE = 1;
    private static final double ADD_PROB = 0.05;

    public AndNeuron(List<Integer> parents, Layer prev) {
        super(parents, prev);
    }

    public AndNeuron(List<Integer> parents, Layer prev, double up, double left, double down, double right) {
        super(parents, prev);
        this.up = up;
        this.left = left;
        this.down = down;
        this.right = right;
    }

    @Override
    public void mutate(Layer prev) {

        up += Math.random() * 2 * MAX_CHANGE - MAX_CHANGE;
        left += Math.random() * 2 * MAX_CHANGE - MAX_CHANGE;
        down += Math.random() * 2 * MAX_CHANGE - MAX_CHANGE;
        right += Math.random() * 2 * MAX_CHANGE - MAX_CHANGE;

        if (Math.random() < ADD_PROB) {

            int n1 = (int) (Math.random() * prev.neurons.size());
            int n2 = (int) (Math.random() * prev.neurons.size());
            while (n2 == n1) {
                n2 = (int) (Math.random() * prev.neurons.size());
            }

            parents.add(n1);
            parents.add(n2);

        }
    }

    public double[] getData() {

        _up = up; _left = left; _down = down; _right = right;

        int i = parents.size();

        Neuron parent1 = prev.neurons.get(parents.get(i - 2));
        Neuron parent2 = prev.neurons.get(parents.get(i - 1));

        double[] data1 = parent1.getData();
        double[] data2 = parent2.getData();

        _value = Math.min(data1[0], data2[0])-Math.abs(data1[0] - data2[0]);

        _up += (data1[1] + data2[1])/2;
        _left += (data1[2] + data2[2])/2;
        _down += (data1[3] + data2[3])/2;
        _right += (data1[4] + data2[4])/2;

        return new double[] {_value, _up, _left, _down, _right};

    }

}
{'fraction_non_alphanumeric': 0.149162456793406, 'fraction_numerical': 0.028183993618718425, 'mean_word_length': 2.096296296296296, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '7143931', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1265, 'n_words': 300}