<commit_before>var Unit;
require('../data/unitsdefinition', 'player');

Unit = (function () {
    var id, Unit, units;

    id = 0;
    units = [];

    Unit = function (x, y, direction, type, player, color) {
        var definition;
        definition = UnitsDefinition.getType(type);
        this.id = id++;
        this.x = x;
        this.y = y;
        this.lastX = x;
        this.lastY = y;
        this.direction = direction;
        this.type = type;
        this.image = definition.image;
        this.speed = definition.speed;
        this.turnSpeed = definition.turnSpeed;
        this.action = 0;
        this.player = player;
        this.moveOffset = 0;
        this.moveOffsetX = 0;
        this.moveOffsetY = 0;
        this.color = color === undefined ?
                Player.getPlayer(player).color : color;

        this.move = function (distance) {
            this.lastX = this.x;
            this.lastY = this.y;
            if ((this.direction >= 1) && (this.direction <= 3)) {
                this.x += distance;
            }
            if (this.direction >= 5) {
                this.x -= distance;
            }
            if ((this.direction == 7) || (this.direction <= 1)) {
                this.y -= distance;
            }
            if ((this.direction >= 3) && (this.direction <= 5)) {
                this.y += distance;
            }
            this.action = 2;
        };

        this.setMoveOffset = function (offset) {
            this.moveOffset = offset;
            if ((this.direction >= 1) && (this.direction <= 3)) {<commit_msg>unit's move method fix<commit_after>var Unit;
require('../data/unitsdefinition', 'player');

Unit = (function () {
    var id, Unit, units;

    id = 0;
    units = [];

    Unit = function (x, y, direction, type, player, color) {
        var definition;
        definition = UnitsDefinition.getType(type);
        this.id = id++;
        this.x = x;
        this.y = y;
        this.lastX = x;
        this.lastY = y;
        this.direction = direction;
        this.type = type;
        this.image = definition.image;
        this.speed = definition.speed;
        this.turnSpeed = definition.turnSpeed;
        this.action = 0;
        this.player = player;
        this.moveOffset = 0;
        this.moveOffsetX = 0;
        this.moveOffsetY = 0;
        this.color = color === undefined ?
                Player.getPlayer(player).color : color;

        this.move = function (distance) {
            var lastX, lastY;
            lastX = this.x;
            lastY = this.y;
            if (distance > 1) {
                this.move(distance - 1);
            }
            this.lastX = lastX;
            this.lastY = lastY;
            switch (this.direction) {
                case 0:
                    this.y -= 2;
                    break;
                case 1:
                    this.x += this.y % 2;
                    this.y -= 1;
                    break;
                case 2:
                    this.x += 1;
                    break;
                case 3:
                    this.x += this.y % 2;
                    this.y += 1;
                    break;
                case 4:
                    this.y += 2;
                    break;
                case 5:
                    this.x -= 1 - (this.y % 2);
                    this.y += 1;
                    break;
                case 6:
                    this.x -= 1;
                    break;
                case 7:
                    this.x -= 1 - (this.y % 2);
                    this.y -= 1;
                    break;
            }
            this.action = 2;
        };

        this.setMoveOffset = function (offset) {
            this.moveOffset = offset;
            if ((this.direction >= 1) && (this.direction <= 3)) {
{'fraction_non_alphanumeric': 0.12273324572930355, 'fraction_numerical': 0.012352168199737189, 'mean_word_length': 1.0981256890848952, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, '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': '3563765', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1025, 'n_words': 255}