2048.js
// Fill numbers in empty items randomly.
Fill numbers in empty items randomly.
Fill numbers in empty items randomly .
function fillNumbers(matrix) {
        var i = 0, item = [], x, y, size = matrix.length;
        for (i = 0; i < size - 2; i++) {
            item = findEmptyItemCoord(matrix);
            if (item.length === 2) {
                x = item[0];
                y = item[1];
                matrix[x][y] = random2_4();
            }
        }
    }
function fillNumbers ( matrix ) { var i = 0 , item = [ ] , x , y , size = matrix . length ; for ( i = 0 ; i < size - 2 ; i ++ ) { item = findEmptyItemCoord ( matrix ) ; if ( item . length === 2 ) { x = item [ 0 ] ; y = item [ 1 ] ; matrix [ x ] [ y ] = random2_4 ( ) ; } } }
Fill numbers in empty items randomly.
Fill numbers in empty items randomly .