Commit e568b52f authored by Hubert Denkmair's avatar Hubert Denkmair
Browse files

show mass in live stats, sort by mass, limit to 20

parent 8c5183c4
......@@ -160,12 +160,19 @@ Game.prototype.HandleBotStatsMessage = function(data)
let el = $('#bot_stats tbody');
let vis = this.vis;
el.empty();
let arr=[];
for (let id in data)
{
let snake = this.vis.GetSnake(id);
data[id].id = id;
arr.push(data[id]);
}
arr.sort(function(a,b) { return b.m-a.m; });
for (let d of arr.slice(0, 20))
{
let snake = this.vis.GetSnake(d.id);
if (!snake) { continue; }
let d = data[id];
let row = $("<tr><td>"+snake.GetName()+"</td><td>"+d.n.toFixed(1)+"</td><td>"+d.c.toFixed(1)+"</td><td>"+d.h.toFixed(1)+"</td></tr>");
let row = $("<tr><td>"+snake.GetName()+"</td><td>"+d.m.toFixed(1)+"</td><td>"+d.n.toFixed(1)+"</td><td>"+d.c.toFixed(1)+"</td><td>"+d.h.toFixed(1)+"</td></tr>");
row.click(function() { vis.FollowName(snake.GetName(), true)});
el.append(row);
}
......
......@@ -266,7 +266,6 @@ GameVisualization.prototype.Unfollow = function()
{
this.follow_name = null;
this.viewport.pausePlugin('follow');
//delete this.viewport.plugins['follow'];
};
GameVisualization.prototype.UpdateStagePosition = function()
......
......@@ -14,6 +14,7 @@
<thead>
<tr>
<td>Snake</td>
<td>mass</td>
<td>natural</td>
<td>carrion</td>
<td>hunted</td>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment