float changeAngleForColor(GameStrategyContext* gameStrategyContext, float angle) { if (isViolet(gameStrategyContext)) { return angle; } else { return -angle; } }
/** * Change the location for color. */ void changeLocationsForColor(GameStrategyContext* gameStrategyContext) { if (isViolet(gameStrategyContext)) { return; } Navigation* navigation = gameStrategyContext->navigation; LocationList* locationList = getNavigationLocationList(navigation); unsigned int i; unsigned int size = locationList->size; for (i = 0; i < size; i++) { Location* location = getLocation(locationList, i); location->y = (float) (GAMEBOARD_HEIGHT - location->y); } }
void setColor(TEAM_COLOR color) { GameStrategyContext* context = getStrategyContext(); appendStringAndDec(getOutputStreamLogger(INFO), "setColor:", color); println(getOutputStreamLogger(INFO)); context->color = color; changeLocationsForColor(); int angle = 675; if (!isViolet()) { angle = -angle; context->robotPosition.y = 2840; } else { context->robotPosition.y = 160; } context->robotPosition.x = 160; context->robotAngle = angle; printStrategyAllDatas(getOutputStreamLogger(INFO)); }