
/** @constructor */
function Player(data) {
    /** @const @type {string} */
    this.id = data["name"];
    /** @const @type {string} */
    this.idEncoded = encodeURIComponent(data["name"]);
    /** @type {number} */
    this.score = data["score"];

    var pos = data["name"].indexOf('|');
    /** @const @type {string} */
    this.name = data["name"].substr(0, pos);

    /** @const @type {string} */
    this.color = '#' +data["name"].substr(pos +1);
}

Player.prototype.update = function(data) {
    this.score = data["score"];
    return data["v"];
};

