X-Git-Url: https://git.ucc.asn.au/?p=progcomp2012.git;a=blobdiff_plain;f=progcomp%2Fjudge%2Fmanager%2Fai_controller.cpp;fp=progcomp%2Fjudge%2Fmanager%2Fai_controller.cpp;h=0000000000000000000000000000000000000000;hp=40ee3df44e60bbfc9b73ae71557ccb27ac745d0e;hb=1a03b2543b67f0551e62babec4cd119f1e0e4640;hpb=e8a611c553bd336550c50ed7491d5800a2ae7142 diff --git a/progcomp/judge/manager/ai_controller.cpp b/progcomp/judge/manager/ai_controller.cpp deleted file mode 100644 index 40ee3df..0000000 --- a/progcomp/judge/manager/ai_controller.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include - -#include "game.h" -#include "stratego.h" - -#include "ai_controller.h" - -using namespace std; - - -/** - * Queries the AI program to setup its pieces. Stores the setup in a st - * @implements Controller::QuerySetup - * @param - * @returns A MovementResult - */ - -MovementResult AI_Controller::QuerySetup(const char * opponentName, std::string setup[]) -{ - switch (colour) - { - case Piece::RED: - if (!SendMessage("RED %s %d %d", opponentName, Game::theGame->theBoard.Width(), Game::theGame->theBoard.Height())) - return MovementResult::BAD_RESPONSE; - break; - case Piece::BLUE: - if (!SendMessage("BLUE %s %d %d", opponentName, Game::theGame->theBoard.Width(), Game::theGame->theBoard.Height())) - return MovementResult::BAD_RESPONSE; - break; - case Piece::NONE: - case Piece::BOTH: - return MovementResult::COLOUR_ERROR; - break; - } - - for (int y = 0; y < 4; ++y) - { - if (!GetMessage(setup[y], timeout)) - return MovementResult::BAD_RESPONSE; - } - - return MovementResult::OK; -} - - -/** - * Queries the AI program to make a move - * @implements Controller::QueryMove - * @param buffer String which stores the AI program's response - * @returns A MovementResult which will be MovementResult::OK if a move was made, or MovementResult::NO_MOVE if the AI did not respond - */ -MovementResult AI_Controller::QueryMove(string & buffer) -{ - if (!Running()) - return MovementResult::NO_MOVE; //AI has quit - Game::theGame->theBoard.Print(output, colour); - - if (!GetMessage(buffer,timeout)) - { - return MovementResult::NO_MOVE; //AI did not respond (within the timeout). It will lose by default. - } - return MovementResult::OK; //Got the message -} -