git.ucc.asn.au
/
progcomp2012.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Reduced of moves before DRAW_DEFAULT
[progcomp2012.git]
/
judge
/
manager
/
controller.cpp
diff --git
a/judge/manager/controller.cpp
b/judge/manager/controller.cpp
index
5691406
..
20b79aa
100644
(file)
--- a/
judge/manager/controller.cpp
+++ b/
judge/manager/controller.cpp
@@
-62,6
+62,14
@@
MovementResult Controller::Setup(const char * opponentName)
{
return MovementResult::BAD_RESPONSE; //You need to include a flag!
}
+
+ //Added 9/04/12 - Check all pieces that can be placed are placed
+ for (int ii = 0; ii <= (int)(Piece::BOMB); ++ii)
+ {
+ if (usedUnits[ii] != Piece::maxUnits[ii])
+ return MovementResult::BAD_RESPONSE; //You must place ALL possible pieces
+ }
+
return MovementResult::OK;
@@
-87,12
+95,15
@@
MovementResult Controller::MakeMove(string & buffer)
buffer += " OK";
return MovementResult::OK;
}
+ */
+ //Restored SURRENDER 9/04/12, because... it kind of seems necessary?
if (buffer == "SURRENDER")
{
buffer += " OK";
return MovementResult::SURRENDER;
}
- */
+
+
int x; int y; string direction="";
stringstream s(buffer);
@@
-188,3
+199,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
+}
+
UCC
git Repository :: git.ucc.asn.au