#ifndef _PARSE_H #define _PARSE_H #include #include // #include #include #include #include "const.h" struct World { std::vector > car, foot; // adj-lists [from][to] std::vector< std::vector > mCar, mFoot; // connection-matrices [from][to] std::vector > coords; // state int n, loot, smell, me, hq, maxCoord, robberStartPos, robberCertain; bool robberPosKnown; std::vector bankMoney; std::vector bankPos; std::vector< std::pair > evidence; // [location,time] std::vector< std::pair > cops; std::pair robber; int robberId; std::vector > borgInfo; // [owner] is set of owned std::set myBorg; // robots I own // cop move history: [world][cop]=move std::vector > > moveHist; // For each cop, we have info on how dirty we know them to be std::vector dcInfo; // dcInfo = dirty_cop_info void print(std::ostream& out) { out << "Car Map" << std::endl; for (unsigned int r=0; r self() { return me < COPS ? cops[me] : robber; } std::set smellyNodes(std::vector > pureFootMap); }; struct guess { int botId, locId, certainty, world; ptype type; guess() {} guess( int bot, int loc, ptype typ, int w ) : botId(bot), locId(loc), world(w), type(typ) {} guess( int bot, int loc, ptype typ, int w, int val ) : botId(bot), locId(loc), certainty(val), world(w), type(typ) {} std::pair pos() { return std::pair(locId, type); } bool betrayal( World& w ) { if ( botId >= COPS ) return false; if ( w.cops[botId].first != locId || w.cops[botId].second != type ) return true; return false; } }; void sendRegister( std::string bot, ptype type ); void recvWorld( World& world ); bool recvTurn( World& world ); // to simplify state machine stuff returns false for game-over void sendRobberMove( int where, ptype type, int whoami, bool bribedLastTurn, std::vector& copsForBribe ); void sendCleanCopMove( std::vector& moveList, std::vector &accuse); void sendDirtyCopMove(std::vector& moveList ); void sendBribe(bool amBribing); // must pass in whether we chose to bribe or not std::vector recvOfferedCops(); int recvVote(); void sendVote( std::vector& votes ); void recvPlan( std::vector >& plan ); void sendPlan( std::vector& info ); void recvInform( std::vector >& info ); void sendInform( const std::vector& info ); void initParse(); std::string getLocName(int locID); int getLocID(std::string locName); #ifdef DUMP_TO_FILE extern std::ofstream debug; #else #define debug cerr #endif #endif