<commit_before>var app = tetrominoes;

app.Game = {
    model : null,
    view : null,

    keyCodes : {
        left: 37, up:38, right: 39, down: 40,
        w: 87, a: 65, s: 83, d: 68
    },

    keys : {
        left: false,
        up: false,
        right: false,
        down: false
    },

    run : function() {
        this.model = app.model.Game.beget();
        this.view =  app.view.Game.beget(this.model);

        this.model.init(this.view);

        this.view.renderBackground();

        this.start();
    },

    start: function() {
        var that = this;

        setInterval(function() {
            return that.updateGame();
        }, 20);

        $(document).keydown( function(e) { that.onKeyDown(e); } );
        $(document).keyup( function(e) { that.onKeyUp(e); } );
    },

    updateGame: function() {
        this.respond();
        this.view.render();
    },

    respond: function() {
        if (this.keys.left) {
            this.model.player.slideLeft();
        } else if (this.keys.right) {
            this.model.player.slideRight();
        } else {
            this.model.player.resetSlideDelay();
        };

        if (this.keys.up) {
            this.model.player.rotate();
        } else {
            this.model.player.resetRotateDelay();
        };
    },

    onKeyDown : function(e) {
        var that = this;
        switch(e.keyCode) {
            case that.keyCodes.left:
            case that.keyCodes.a:
                that.keys.left = true;
                that.keys.right = false;
                break;

            case that.keyCodes.right:
            case that.keyCodes.d:
                that.keys.right = true;
                that.keys.left = false;
                break;

            case that.keyCodes.up:
            case that.keyCodes.w:
                that.keys.up = true;
                break;
        };
    },

    onKeyUp : function(e) {
        var that = this;
        switch(e.keyCode) {
            case that.keyCodes.left:
            case that.keyCodes.a:
                that.keys.left = false;
                break;

            case that.keyCodes.right:
            case that.keyCodes.d:
                that.keys.right = false;
                break;

            case that.keyCodes.up:
            case that.keyCodes.w:
                that.keys.up = false;
                break;
        };
    },

}


<commit_msg>Added vim home keys to key bindings<commit_after>var app = tetrominoes;

app.Game = {
    model : null,
    view : null,

    keyCodes : {
        left: 37, up:38, right: 39, down: 40,
        w: 87, a: 65, s: 83, d: 68,
        h: 72, j: 74, k: 75, l: 76,
    },

    keys : {
        left: false,
        up: false,
        right: false,
        down: false
    },

    run : function() {
        this.model = app.model.Game.beget();
        this.view =  app.view.Game.beget(this.model);

        this.model.init(this.view);

        this.view.renderBackground();

        this.start();
    },

    start: function() {
        var that = this;

        setInterval(function() {
            return that.updateGame();
        }, 20);

        $(document).keydown( function(e) { that.onKeyDown(e); } );
        $(document).keyup( function(e) { that.onKeyUp(e); } );
    },

    updateGame: function() {
        this.respond();
        this.view.render();
    },

    respond: function() {
        if (this.keys.left) {
            this.model.player.slideLeft();
        } else if (this.keys.right) {
            this.model.player.slideRight();
        } else {
            this.model.player.resetSlideDelay();
        };

        if (this.keys.up) {
            this.model.player.rotate();
        } else {
            this.model.player.resetRotateDelay();
        };
    },

    onKeyDown : function(e) {
        var that = this;
        switch(e.keyCode) {
            case that.keyCodes.left:
            case that.keyCodes.a:
            case that.keyCodes.h:
                that.keys.left = true;
                that.keys.right = false;
                break;

            case that.keyCodes.right:
            case that.keyCodes.d:
            case that.keyCodes.l:
                that.keys.right = true;
                that.keys.left = false;
                break;

            case that.keyCodes.up:
            case that.keyCodes.w:
            case that.keyCodes.k:
                that.keys.up = true;
                break;
        };
    },

    onKeyUp : function(e) {
        var that = this;
        switch(e.keyCode) {
            case that.keyCodes.left:
            case that.keyCodes.a:
            case that.keyCodes.h:
                that.keys.left = false;
                break;

            case that.keyCodes.right:
            case that.keyCodes.d:
            case that.keyCodes.l:
                that.keys.right = false;
                break;

            case that.keyCodes.up:
            case that.keyCodes.w:
            case that.keyCodes.k:
                that.keys.up = false;
                break;
        };
    },

}



{'fraction_non_alphanumeric': 0.1267994478406626, 'fraction_numerical': 0.008676789587852495, 'mean_word_length': 1.2512205947625388, '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': '1396093', 'n_tokens_mistral': 1612, 'n_tokens_neox': 1531, 'n_words': 296}