tanks

Blow up enemy tanks using code
git clone https://git.woozle.org/neale/tanks.git

commit
d88d44f
parent
144d988
author
Neale Pickett
date
2024-12-05 15:51:13 -0700 MST
sort game rankings by kills
2 files changed,  +7, -2
M www/index.html
+1, -1
1@@ -95,7 +95,7 @@
2           <tr>
3             <th></th>
4             <th>Name</th>
5-            <th>Score</th>
6+            <th>Kills</th>
7             <th>Death</th>
8             <th>Killer</th>
9             <th>Error</th>
M www/replay.mjs
+6, -1
 1@@ -182,7 +182,12 @@ class Replay {
 2         let tbody = this.results.querySelector("tbody")
 3         tbody.replaceChildren()
 4 
 5-        for (let tank of game.tanks) {
 6+        let byKills = Object.keys(game.tanks)
 7+        byKills.sort((a, b) => game.tanks[a].kills - game.tanks[b].kills)
 8+        byKills.reverse()
 9+
10+        for (let i of byKills) {
11+            let tank = game.tanks[i]
12             let tr = tbody.appendChild(document.createElement("tr"))
13 
14             let tdSwatch = tr.appendChild(document.createElement("td"))