From fda21e69af7d794fa2280ce613144e5bbd8e1f5e Mon Sep 17 00:00:00 2001 From: Sam Moore Date: Sat, 24 Dec 2011 13:52:12 +0800 Subject: [PATCH] Bug in simulate.py caused by "INTERNAL_ERROR" When INTERNAL_ERRORs occur, the colour wasn't added to the array in the "ALL" results. So when the script looks up agents["ALL"][index][4] (the colour entry), there was an indexing error. Fixed by adding the colour to the result array when INTERNAL_ERROR occurs. TODO: Discover cause of INTERNAL_ERROR - in the manager program It occurs on mufasa, but not on my laptop. I believe it is due to AI timeouts not being handled correctly by the manager program (stratego). On my laptop, things run nice and fast, and since all the AI work properly, there are no timeouts. On mufasa, things run shit and slow, and pretty much every game I tested ended with a move timeout. Timeout causes broken pipe after AI program is told to exit? As a temporary measure, increased timeout to 60s (from 2s). If this doesn't stop timeouts, there must be some other factor making things slow. "The problem is determining where the shittiness lies... is it the shittiness of the VM, the shittiness of python, the shittiness of the manager program..." Running another test round on mufasa over christmas. Hopefully it will finish running by new year. (Assume 60s a move, 300 moves a game... 12 games...) Considering putting my laptop in the clubroom and just running the competition on that. --- agents/basic_cpp/Makefile | 2 +- judge/manager/ai_controller.h | 2 +- judge/simulator/Makefile | 10 +++++----- judge/simulator/simulate.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/agents/basic_cpp/Makefile b/agents/basic_cpp/Makefile index 0a249b3..6c1f9fb 100644 --- a/agents/basic_cpp/Makefile +++ b/agents/basic_cpp/Makefile @@ -2,7 +2,7 @@ # Sample C++ Stratego AI # UCC Programming Competition 2012 -CPP = g++ -Wall -pedantic -lSDL -lGL -g +CPP = g++ -Wall -pedantic -g OBJ = basic_cpp.o BIN = basic_cpp diff --git a/judge/manager/ai_controller.h b/judge/manager/ai_controller.h index 7d62591..ee053e6 100644 --- a/judge/manager/ai_controller.h +++ b/judge/manager/ai_controller.h @@ -11,7 +11,7 @@ class AI_Controller : public Controller, private Program { public: - AI_Controller(const Piece::Colour & newColour, const char * executablePath, const double newTimeout = 2.0) : Controller(newColour, executablePath), Program(executablePath), timeout(newTimeout) {} + AI_Controller(const Piece::Colour & newColour, const char * executablePath, const double newTimeout = 60.0) : Controller(newColour, executablePath), Program(executablePath), timeout(newTimeout) {} virtual ~AI_Controller() {} diff --git a/judge/simulator/Makefile b/judge/simulator/Makefile index 6296c3a..c95e891 100644 --- a/judge/simulator/Makefile +++ b/judge/simulator/Makefile @@ -2,11 +2,11 @@ # Not used for building simulate.py # Used for building/removing results -BASEDIR = /home/sam/Documents/progcomp2012/progcomp -RESULTSDIR = /home/sam/Documents/progcomp2012/progcomp/web/results -LOGDIR = /home/sam/Documents/progcomp2012/progcomp/web/log -AGENTSDIR = /home/sam/Documents/progcomp2012/progcomp/agents -MANAGER = /home/sam/Documents/progcomp2012/progcomp/judge/manager/stratego +BASEDIR = /../../ +RESULTSDIR = /../../web/results +LOGDIR = /../../web/log +AGENTSDIR = /../../agents +MANAGER = /../../judge/manager/stratego diff --git a/judge/simulator/simulate.py b/judge/simulator/simulate.py index aead755..b84a525 100755 --- a/judge/simulator/simulate.py +++ b/judge/simulator/simulate.py @@ -234,8 +234,8 @@ for roundNumber in range(totalRounds, totalRounds + nRounds): sys.stdout.write("Garbage output! \"" + outline + "\"\n") red["INTERNAL_ERROR"].append((blue["name"], gameID, scores["INTERNAL_ERROR"][0])) blue["INTERNAL_ERROR"].append((red["name"], gameID, scores["INTERNAL_ERROR"][0])) - red["ALL"].append((blue["name"], gameID, scores["INTERNAL_ERROR"][0], "INTERNAL_ERROR")) - blue["ALL"].append((red["name"], gameID, scores["INTERNAL_ERROR"][0], "INTERNAL_ERROR")) + red["ALL"].append((blue["name"], gameID, scores["INTERNAL_ERROR"][0], "INTERNAL_ERROR", "RED")) + blue["ALL"].append((red["name"], gameID, scores["INTERNAL_ERROR"][0], "INTERNAL_ERROR", "BLUE")) managerErrors += 1 else: -- 2.20.1