From 4f44d0bbb692b90d4caa13ce271c0960f7443a22 Mon Sep 17 00:00:00 2001 From: "Paul S. Ferrell" Date: Thu, 8 Oct 2009 11:15:06 -0600 Subject: [PATCH 1/4] I hate neale. --- tanks/lib/GameMath.py | 2 +- tanks/lib/Pflanzarr.py | 6 +++--- tanks/run_tanks.py | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tanks/lib/GameMath.py b/tanks/lib/GameMath.py index ff47880..481bf81 100644 --- a/tanks/lib/GameMath.py +++ b/tanks/lib/GameMath.py @@ -48,7 +48,7 @@ def displacePoly(points, disp, limits, coordSequence=False): maxX, maxY = limits basePoints = [] for point in points: - x,y = point[0] + disp[0], point[1] + disp[1] + x,y = int(point[0] + disp[0]), int(point[1] + disp[1]) # Check if duplication is needed on each axis if x > maxX: diff --git a/tanks/lib/Pflanzarr.py b/tanks/lib/Pflanzarr.py index d7d50e0..8b19777 100644 --- a/tanks/lib/Pflanzarr.py +++ b/tanks/lib/Pflanzarr.py @@ -203,16 +203,16 @@ class Pflanzarr: html = ['', 'Game %d results', - '', + '', '', '', '
TeamKillsCause of Death'] for tank in tanks: if tank is winner: rowStyle = 'style="font-weight:bold; '\ - 'background-color:%s"' % tank._color + 'background-color:%s"' % tank.color else: - rowStyle = 'style="background-color:%s"' % tank._color + rowStyle = 'style="background-color:%s"' % tank.color if name: name = xml.sax.saxutils.escape(tank.name) else: diff --git a/tanks/run_tanks.py b/tanks/run_tanks.py index f680bbe..f8950d1 100755 --- a/tanks/run_tanks.py +++ b/tanks/run_tanks.py @@ -1,10 +1,11 @@ #! /usr/bin/python +import asynchat +import asyncore import optparse import shutil +import socket import time -import asyncore -import asynchat from tanks import Pflanzarr T = 60*5 @@ -41,7 +42,7 @@ class Flagger(asynchat.async_chat): self.flag = team -def run_tanks(): +def run_tanks(args, turns): p = Pflanzarr.Pflanzarr(args[0], args[1]) p.run(turns) @@ -84,7 +85,7 @@ def main(): asyncore.loop(60, count=1) now = time.time() if now - lastrun >= 60: - run_tanks() + run_tanks(args, turns) lastrun = now if __name__ == '__main__': From 82351791296f7eb90730e831f79cf2b47f851b06 Mon Sep 17 00:00:00 2001 From: "Paul S. Ferrell" Date: Thu, 8 Oct 2009 11:18:40 -0600 Subject: [PATCH 2/4] More bug fixes. --- tanks/lib/Pflanzarr.py | 8 ++++---- tanks/run_tanks.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tanks/lib/Pflanzarr.py b/tanks/lib/Pflanzarr.py index 8b19777..ac600a2 100644 --- a/tanks/lib/Pflanzarr.py +++ b/tanks/lib/Pflanzarr.py @@ -213,7 +213,7 @@ class Pflanzarr: 'background-color:%s"' % tank.color else: rowStyle = 'style="background-color:%s"' % tank.color - if name: + if tank.name: name = xml.sax.saxutils.escape(tank.name) else: name = '#default' @@ -250,9 +250,9 @@ class Pflanzarr: clearFrames = ['rm', '-rf', '%s' % self._imageDir] print 'Making Movie' - subprocess.call(movieCmd) -# subprocess.call(movieCmd, stderr=open('/dev/null', 'w'), -# stdout=open('/dev/null', 'w')) +# subprocess.call(movieCmd) + subprocess.call(movieCmd, stderr=open('/dev/null', 'w'), + stdout=open('/dev/null', 'w')) subprocess.call(clearFrames) def _outputErrors(self, tank): diff --git a/tanks/run_tanks.py b/tanks/run_tanks.py index f8950d1..ba52a28 100755 --- a/tanks/run_tanks.py +++ b/tanks/run_tanks.py @@ -3,6 +3,7 @@ import asynchat import asyncore import optparse +import os import shutil import socket import time @@ -59,7 +60,7 @@ def run_tanks(args, turns): highest = gameNums[0] for num in gameNums: if highest - MAX_HIST > num and not (num % HIST_STEP == 0): - shutil.rmtree(os.path.join(path, num)) + shutil.rmtree(os.path.join(path, str(num))) try: winner = open('/var/lib/tanks/winner').read().strip() From a4ebc71b58122bb8b2cfb3b53f428e66df9deb3f Mon Sep 17 00:00:00 2001 From: "Paul S. Ferrell" Date: Thu, 8 Oct 2009 11:19:46 -0600 Subject: [PATCH 3/4] This was neale's fault. --- tanks/run_tanks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tanks/run_tanks.py b/tanks/run_tanks.py index ba52a28..ae83990 100755 --- a/tanks/run_tanks.py +++ b/tanks/run_tanks.py @@ -43,7 +43,7 @@ class Flagger(asynchat.async_chat): self.flag = team -def run_tanks(args, turns): +def run_tanks(args, turns, flagger): p = Pflanzarr.Pflanzarr(args[0], args[1]) p.run(turns) @@ -86,7 +86,7 @@ def main(): asyncore.loop(60, count=1) now = time.time() if now - lastrun >= 60: - run_tanks(args, turns) + run_tanks(args, turns, flagger) lastrun = now if __name__ == '__main__': From 2231337f07b4e733a3d2487cf987f275f1ff3b36 Mon Sep 17 00:00:00 2001 From: Alexander Brugh Date: Thu, 8 Oct 2009 11:27:33 -0600 Subject: [PATCH 4/4] repoint valued some of these as per neale, added a gray code puzzle at 400 --- puzzles/sequence/400/index.html | 26 +---------------------- puzzles/sequence/400/key | 2 +- puzzles/sequence/600/index.html | 27 ++++++++++++++++++++++++ puzzles/sequence/600/key | 1 + puzzles/sequence/{500 => 700}/index.html | 0 puzzles/sequence/{500 => 700}/key | 0 6 files changed, 30 insertions(+), 26 deletions(-) create mode 100644 puzzles/sequence/600/index.html create mode 100644 puzzles/sequence/600/key rename puzzles/sequence/{500 => 700}/index.html (100%) rename puzzles/sequence/{500 => 700}/key (100%) diff --git a/puzzles/sequence/400/index.html b/puzzles/sequence/400/index.html index 9787d0f..f0c33ca 100644 --- a/puzzles/sequence/400/index.html +++ b/puzzles/sequence/400/index.html @@ -1,27 +1,3 @@
-00000000  61 61 9e 23 01 0c 0c 40  0d 05 40 29 13 08 0d 01
-00000010  05 0c 4e 40 40 33 0f 0d  05 40 19 05 01 12 13 40
-00000020  01 07 0f 4d 4d 0e 05 16  05 12 40 0d 09 0e 04 40
-00000030  08 0f 17 40 0c 0f 0e 07  6a 10 12 05 03 09 13 05
-00000040  0c 19 4d 4d 08 01 16 09  0e 07 40 0c 09 14 14 0c
-00000050  05 40 0f 12 40 0e 0f 40  0d 0f 0e 05 19 40 09 0e
-00000060  40 0d 19 40 10 15 12 13  05 4c 40 01 0e 04 40 0e
-00000070  0f 14 08 09 0e 07 6a 10  01 12 14 09 03 15 0c 01
-00000080  12 40 14 aa 61 62 9d 0f  40 09 0e 14 05 12 05 13
-00000090  14 40 0d 05 40 0f 0e 40  13 08 0f 12 05 4c 40 29
-000000a0  40 14 08 0f 15 07 08 14  40 29 40 17 0f 15 0c 04
-000000b0  40 13 01 09 0c 40 01 02  0f 15 14 40 01 6a 0c 09
-000000c0  14 14 0c 05 40 01 0e 04  40 13 05 05 40 14 08 05
-000000d0  40 17 01 14 05 12 19 40  10 01 12 14 40 0f 06 40
-000000e0  14 08 05 40 17 0f 12 0c  04 4e 40 40 29 14 40 09
-000000f0  13 40 01 40 17 01 19 40  29 40 08 01 16 05 40 0f
-00000100  06 6a 04 12 09 16 09 3b  61 63 9c 0e 07 40 0f 06
-00000110  06 40 14 08 05 40 13 10  0c 05 05 0e 40 01 0e 04
-00000120  40 12 05 07 15 0c 01 14  09 0e 07 40 14 08 05 40
-00000130  03 09 12 03 15 0c 01 14  09 0f 0e 4e 40 40 37 08
-00000140  05 0e 05 16 05 12 40 29  6a 06 09 0e 04 40 0d 19
-00000150  13 05 0c 06 40 07 12 0f  17 09 0e 07 40 07 12 09
-00000160  0d 40 01 02 0f 15 14 40  14 08 05 40 0d 0f 15 14
-00000170  08 5b 40 17 08 05 0e 05  16 05 12 40 09 14 40 09
-00000180  13 40 01 40 04 01 0d 10  4c 6a 04 bb __ __ __
+0000 0001 0011 0010 0110 0111 _
 
diff --git a/puzzles/sequence/400/key b/puzzles/sequence/400/key index 7a6f1f6..7d0d318 100644 --- a/puzzles/sequence/400/key +++ b/puzzles/sequence/400/key @@ -1 +1 @@ -61 64 9b +0101 diff --git a/puzzles/sequence/600/index.html b/puzzles/sequence/600/index.html new file mode 100644 index 0000000..9787d0f --- /dev/null +++ b/puzzles/sequence/600/index.html @@ -0,0 +1,27 @@ +
+00000000  61 61 9e 23 01 0c 0c 40  0d 05 40 29 13 08 0d 01
+00000010  05 0c 4e 40 40 33 0f 0d  05 40 19 05 01 12 13 40
+00000020  01 07 0f 4d 4d 0e 05 16  05 12 40 0d 09 0e 04 40
+00000030  08 0f 17 40 0c 0f 0e 07  6a 10 12 05 03 09 13 05
+00000040  0c 19 4d 4d 08 01 16 09  0e 07 40 0c 09 14 14 0c
+00000050  05 40 0f 12 40 0e 0f 40  0d 0f 0e 05 19 40 09 0e
+00000060  40 0d 19 40 10 15 12 13  05 4c 40 01 0e 04 40 0e
+00000070  0f 14 08 09 0e 07 6a 10  01 12 14 09 03 15 0c 01
+00000080  12 40 14 aa 61 62 9d 0f  40 09 0e 14 05 12 05 13
+00000090  14 40 0d 05 40 0f 0e 40  13 08 0f 12 05 4c 40 29
+000000a0  40 14 08 0f 15 07 08 14  40 29 40 17 0f 15 0c 04
+000000b0  40 13 01 09 0c 40 01 02  0f 15 14 40 01 6a 0c 09
+000000c0  14 14 0c 05 40 01 0e 04  40 13 05 05 40 14 08 05
+000000d0  40 17 01 14 05 12 19 40  10 01 12 14 40 0f 06 40
+000000e0  14 08 05 40 17 0f 12 0c  04 4e 40 40 29 14 40 09
+000000f0  13 40 01 40 17 01 19 40  29 40 08 01 16 05 40 0f
+00000100  06 6a 04 12 09 16 09 3b  61 63 9c 0e 07 40 0f 06
+00000110  06 40 14 08 05 40 13 10  0c 05 05 0e 40 01 0e 04
+00000120  40 12 05 07 15 0c 01 14  09 0e 07 40 14 08 05 40
+00000130  03 09 12 03 15 0c 01 14  09 0f 0e 4e 40 40 37 08
+00000140  05 0e 05 16 05 12 40 29  6a 06 09 0e 04 40 0d 19
+00000150  13 05 0c 06 40 07 12 0f  17 09 0e 07 40 07 12 09
+00000160  0d 40 01 02 0f 15 14 40  14 08 05 40 0d 0f 15 14
+00000170  08 5b 40 17 08 05 0e 05  16 05 12 40 09 14 40 09
+00000180  13 40 01 40 04 01 0d 10  4c 6a 04 bb __ __ __
+
diff --git a/puzzles/sequence/600/key b/puzzles/sequence/600/key new file mode 100644 index 0000000..7a6f1f6 --- /dev/null +++ b/puzzles/sequence/600/key @@ -0,0 +1 @@ +61 64 9b diff --git a/puzzles/sequence/500/index.html b/puzzles/sequence/700/index.html similarity index 100% rename from puzzles/sequence/500/index.html rename to puzzles/sequence/700/index.html diff --git a/puzzles/sequence/500/key b/puzzles/sequence/700/key similarity index 100% rename from puzzles/sequence/500/key rename to puzzles/sequence/700/key