From 926de8edc185b92f50ca825637e870dabeb0f8eb Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Wed, 30 Jul 2014 01:25:29 +0200 Subject: [PATCH 1/9] maybe fix showing cannon fire on death --- tanks.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tanks.js b/tanks.js index 3f11bc9..e44d880 100644 --- a/tanks.js +++ b/tanks.js @@ -62,11 +62,7 @@ function Tank(ctx, width, height, color, sensors) { if (!this.dead) { return; } - if (this.fire == 5) { - // one frame of cannon fire - this.draw_cannon(); - this.fire = 0; - } + var points = 7; var angle = Math.PI / points; @@ -74,6 +70,15 @@ function Tank(ctx, width, height, color, sensors) { ctx.translate(this.x, this.y); ctx.rotate(this.rotation); + if (this.fire == 5) { + ctx.save(); + ctx.rotate(this.turret); + // one frame of cannon fire + this.draw_cannon(); + this.fire = 0; + ctx.restore(); + } + ctx.lineWidth = 2; ctx.strokeStyle = craterStroke; ctx.fillStyle = craterFill; From 29240f7331322ca9c781e2a24e4aee214f4054dd Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Wed, 30 Jul 2014 13:24:44 +0200 Subject: [PATCH 2/9] fix infinite loop in summary.awk --- summary.awk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/summary.awk b/summary.awk index 88da22b..d98975e 100755 --- a/summary.awk +++ b/summary.awk @@ -25,7 +25,7 @@ BEGIN { print "

Rankings

"; print "

Over the last " ngames" games only.

"; print "
    "; - for (i = rounds - ngames - 1; i < rounds; i += 1) { + for (i = rounds - ngames - 1; i > 0 && i < rounds; i += 1) { fn = sprintf("round-%04d.html", i) while (getline < fn) { if ($2 == "score") { From 5f41251403197341e81c8095b9c62135d41bdf36 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Wed, 30 Jul 2014 13:26:29 +0200 Subject: [PATCH 3/9] allow pausing of round playback --- run-tanks | 3 +++ tanks.js | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/run-tanks b/run-tanks index 062b38d..5ad2102 100755 --- a/run-tanks +++ b/run-tanks @@ -36,6 +36,9 @@ cat <$fn Tanks Round $next + + + From 4fac8f422e5a9c58d2044e9f5962cb32e1b214e5 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Thu, 31 Jul 2014 04:08:31 +0000 Subject: [PATCH 9/9] tput fall back to FS --- contrib/tput | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/tput b/contrib/tput index c864cd1..8a3ce59 100755 --- a/contrib/tput +++ b/contrib/tput @@ -39,7 +39,7 @@ def read_tank(infile): def post_tank(headers, code, url): token = os.environ.get('token') if not token: - raise RuntimeError("Must provide token in 'token' environment variable") + token = open('token').readline().strip() request = {} request['token'] = token request['name'] = headers.get('Tank-Name', '')