game.js
function Game(name) {
    this.name = name;
    this.board = [];  // list representation
    this.boardmat = [];  // matrix representation
    for (var i=0; i<181; i++) {
        this.boardmat[i] = new Array(181);
    }
    this.players = {};
    this.turn_pieces = [];  // pieces played this turn
    this.chat = [];  // chat log

    // board dimensions
    this.dimensions = {'top': 90, 'right': 90, 'bottom': 90, 'left': 90};

    /* Keep track of the pieces by having a list of piece objects each with a
     * count attribute that tracks how many of that piece are left. When this
     * reaches 0, we remove the piece object from the list.
     */
    this.pieces = [];
    var colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple'];
    var shapes =  ['circle', 'star', 'diamond', 'square', 'triangle', 'clover'];
    for (var c in colors) {
        if (!colors.hasOwnProperty(c)) {
            continue;
        }
        for (var s in shapes) {
            if (!shapes.hasOwnProperty(s)) {
                continue;
            }
            this.pieces.push({'piece': new Piece(shapes[s], colors[c]), 'count': 3});
        }
    }
}
function Game(name) {
    this.name = name;
    this.board = [];  // list representation
    this.boardmat = [];  // matrix representation
    for (var i=0; i<181; i++) {
        this.boardmat[i] = new Array(181);
    }
    this.players = {};
    this.turn_pieces = [];  // pieces played this turn
    this.chat = [];  // chat log

    // board dimensions
    this.dimensions = {'top': 90, 'right': 90, 'bottom': 90, 'left': 90};

    /* Keep track of the pieces by having a list of piece objects each with a
     * count attribute that tracks how many of that piece are left. When this
     * reaches 0, we remove the piece object from the list.
     */
    this.pieces = [];
    var colors = ['red', 'orange', 'yellow', 'green', 'blue', 'purple'];
    var shapes =  ['circle', 'star', 'diamond', 'square', 'triangle', 'clover'];
    for (var c in colors) {
        if (!colors.hasOwnProperty(c)) {
            continue;
        }
        for (var s in shapes) {
            if (!shapes.hasOwnProperty(s)) {
                continue;
            }
            this.pieces.push({'piece': new Piece(shapes[s], colors[c]), 'count': 3});
        }
    }
}
function Game ( name ) { this . name = name ; this . board = [ ] ; // list representation this . boardmat = [ ] ; // matrix representation for ( var i = 0 ; i < 181 ; i ++ ) { this . boardmat [ i ] = new Array ( 181 ) ; } this . players = { } ; this . turn_pieces = [ ] ; // pieces played this turn this . chat = [ ] ; // chat log // board dimensions this . dimensions = { 'top' : 90 , 'right' : 90 , 'bottom' : 90 , 'left' : 90 } ; /* Keep track of the pieces by having a list of piece objects each with a
     * count attribute that tracks how many of that piece are left. When this
     * reaches 0, we remove the piece object from the list.
     */ this . pieces = [ ] ; var colors = [ 'red' , 'orange' , 'yellow' , 'green' , 'blue' , 'purple' ] ; var shapes = [ 'circle' , 'star' , 'diamond' , 'square' , 'triangle' , 'clover' ] ; for ( var c in colors ) { if ( ! colors . hasOwnProperty ( c ) ) { continue ; } for ( var s in shapes ) { if ( ! shapes . hasOwnProperty ( s ) ) { continue ; } this . pieces . push ( { 'piece' : new Piece ( shapes [ s ] , colors [ c ] ) , 'count' : 3 } ) ; } } }
number of lines to store from chats
number of lines to store from chats