X-Git-Url: https://git.ucc.asn.au/?p=progcomp2012.git;a=blobdiff_plain;f=judge%2Fmanager%2Fcontroller.cpp;h=d2687927e1301de5284af71f2dc0bafc05b4c806;hp=f5c99ce262c45402b7936ef55eb2089eb3ce24a3;hb=476617a8222c8c56404c12a65dd75c55b8019542;hpb=e1153eebe8cfd0c881cef2ff8fca63f130e736b3 diff --git a/judge/manager/controller.cpp b/judge/manager/controller.cpp index f5c99ce..d268792 100644 --- a/judge/manager/controller.cpp +++ b/judge/manager/controller.cpp @@ -80,6 +80,8 @@ MovementResult Controller::MakeMove(string & buffer) if (query != MovementResult::OK) return query; + /* + //Removed 3/01/12 NO_MOVE now not allowed, SURRENDER is undocumented and not necessary if (buffer == "NO_MOVE") { buffer += " OK"; @@ -90,6 +92,7 @@ MovementResult Controller::MakeMove(string & buffer) buffer += " OK"; return MovementResult::SURRENDER; } + */ int x; int y; string direction=""; stringstream s(buffer); @@ -185,3 +188,24 @@ MovementResult Controller::MakeMove(string & buffer) return moveResult; } + +/** + * Fixes the name of the controller + * Should be called AFTER the constructor, since it modifies the name string, which might be used in the constructor + */ +void Controller::FixName() +{ + for (unsigned int ii=0; ii < name.size(); ++ii) + { + if (name[ii] == ' ') + { + name.erase(ii); //Just erase everything after the first whitespace + break; + } + } + //This is kind of hacky; I added it so that I could pass arguments to the AIs + //Because simulate.py doesn't like extra arguments showing up in the AI name at the end of the game (its fine until then) + //So I'll just remove them, after they have been passed! What could possibly go wrong? + // - Last entry in Sam Moore's diary, 2012 +} +