本文整理汇总了Java中battlecode.common.GameActionException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java GameActionException.printStackTrace方法的具体用法?Java GameActionException.printStackTrace怎么用?Java GameActionException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类battlecode.common.GameActionException
的用法示例。
在下文中一共展示了GameActionException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReducedMapTerrain
import battlecode.common.GameActionException; //导入方法依赖的package包/类
public static TerrainTile getReducedMapTerrain(RobotController rc, int yR,
int xR) {
int channelOfLoc = chReducedMapInfo + toInt(yR, xR);
int iTerrain = 0;
try {
iTerrain = rc.readBroadcast(channelOfLoc);
} catch (GameActionException e) {
e.printStackTrace();
}
switch (iTerrain) {
case 1:
return TerrainTile.NORMAL;
case 2:
return TerrainTile.ROAD;
case 3:
return TerrainTile.VOID;
default: // 0
return TerrainTile.OFF_MAP;
}
}
示例2: requestSoldierId
import battlecode.common.GameActionException; //导入方法依赖的package包/类
public static int requestSoldierId(RobotController rc) {
try {
int myId = rc.readBroadcast(chNextSoldierId);
if (!isAlive(rc, myId + 1)) {
rc.broadcast(chNextSoldierId, myId + 1);
} else {
int i = 2;
while (i < GameConstants.MAX_ROBOTS) {
int id = myId + i % GameConstants.MAX_ROBOTS;
if (!isAlive(rc, id)) {
rc.broadcast(chNextSoldierId, id);
break;
}
i++;
}
}
return myId;
} catch (GameActionException e) {
e.printStackTrace();
}
return 0;
}
示例3: broadcastBestPastrLocation
import battlecode.common.GameActionException; //导入方法依赖的package包/类
/**
* broadcast the location which is optimal for herding cows
*
* @param rc
* @param bestLocation
*/
public static void broadcastBestPastrLocation(RobotController rc,
MapLocation bestLocation) {
int data = bestLocation.x * 1000 + bestLocation.y;
try {
rc.broadcast(chBestPastrLocation, data);
} catch (GameActionException e) {
e.printStackTrace();
}
}
示例4: demandSoldierRole
import battlecode.common.GameActionException; //导入方法依赖的package包/类
/**
* this method should be called by the control unit. It overrides the
* SoldierRole which is incorporated by the next produced unit
*
* @param rc
* @param role
*/
public static void demandSoldierRole(RobotController rc, SoldierRole role) {
try {
rc.broadcast(chNextSoldierRole, role.ordinal());
} catch (GameActionException e) {
e.printStackTrace();
}
}
示例5: announceTeamId
import battlecode.common.GameActionException; //导入方法依赖的package包/类
/**
* for SOLDIER. They have to announce the teamId that they incorporate.
*
* @param rc
* @param role
*/
public static void announceTeamId(RobotController rc, int soldierId,
int teamId) {
int c = getSoldierChannel(soldierId);
try {
rc.broadcast(c + 2, teamId);
} catch (GameActionException e) {
e.printStackTrace();
}
}
示例6: signalAlive
import battlecode.common.GameActionException; //导入方法依赖的package包/类
/**
* for SOLDIER. should be called at the beginning of each round. Soldier
* broadcasts that he is still alive and his current {@link MapLocation}
*
* @param rc
* @param soldierId
*/
public static void signalAlive(RobotController rc, int soldierId) {
int c = getSoldierChannel(soldierId);
try {
rc.broadcast(c + 1, Clock.getRoundNum());
rc.broadcast(c + 3, toInt(rc.getLocation()));
} catch (GameActionException e) {
e.printStackTrace();
}
}
示例7: broadcastOpponentMilkQuantity
import battlecode.common.GameActionException; //导入方法依赖的package包/类
public static void broadcastOpponentMilkQuantity(RobotController rc,
int quantity) {
try {
rc.broadcast(chOppMilkQuantity, quantity);
} catch (GameActionException e) {
e.printStackTrace();
}
}
示例8: broadcastTask
import battlecode.common.GameActionException; //导入方法依赖的package包/类
public static void broadcastTask(RobotController rc, Task task,
MapLocation target, int teamId) {
int c = getTeamChannel(teamId);
try {
rc.broadcast(c + 2, task.ordinal());
rc.broadcast(c + 3, toInt(target));
} catch (GameActionException e) {
e.printStackTrace();
}
}
示例9: requestTeamId
import battlecode.common.GameActionException; //导入方法依赖的package包/类
/**
* for SOLDIER. It returns the team id which should be incorporated by the
* requesting soldier.
*
* @param rc
* @return
*/
public static int requestTeamId(RobotController rc) {
try {
return rc.readBroadcast(chNextTeamId);
} catch (GameActionException e) {
e.printStackTrace();
}
return 0;
}
示例10: getSelfDestructionLocation
import battlecode.common.GameActionException; //导入方法依赖的package包/类
/**
* executed by the HQ to find pastr who wants to be destroyed
*
* @param rc
* @return
*/
public static MapLocation getSelfDestructionLocation(RobotController rc) {
int data = 0;
try {
data = rc.readBroadcast(chSelfDestruction);
} catch (GameActionException e) {
e.printStackTrace();
}
MapLocation selfDestruction = new MapLocation(data / 1000, data % 1000);
return selfDestruction;
}
示例11: broadcastOpponentMeanDistToCenter
import battlecode.common.GameActionException; //导入方法依赖的package包/类
public static void broadcastOpponentMeanDistToCenter(RobotController rc,
int meanDist) {
try {
rc.broadcast(chOppMeanDistToCenter, meanDist);
} catch (GameActionException e) {
e.printStackTrace();
}
}
示例12: announcePastrDeath
import battlecode.common.GameActionException; //导入方法依赖的package包/类
public static void announcePastrDeath(RobotController rc) {
try {
int count = rc.readBroadcast(chPastrCount);
if (count > 0) {
count--;
}
rc.broadcast(chPastrCount, count);
} catch (GameActionException e) {
e.printStackTrace();
}
}
示例13: getTarget
import battlecode.common.GameActionException; //导入方法依赖的package包/类
public static MapLocation getTarget(RobotController rc, int teamId) {
int c = getTeamChannel(teamId);
try {
int encoded = rc.readBroadcast(c + 3);
return toMapLocation(encoded);
} catch (GameActionException e) {
e.printStackTrace();
}
return new MapLocation(0, 0);
}
示例14: getPositionalCenterOfTeam
import battlecode.common.GameActionException; //导入方法依赖的package包/类
public static MapLocation getPositionalCenterOfTeam(RobotController rc,
int teamId) {
int c = getTeamChannel(teamId);
try {
return toMapLocation(rc.readBroadcast(c + 4));
} catch (GameActionException e) {
e.printStackTrace();
}
return new MapLocation(0, 0);
}
示例15: resetMapComplexity
import battlecode.common.GameActionException; //导入方法依赖的package包/类
public static void resetMapComplexity(RobotController rc) {
try {
rc.broadcast(chMapComplexity, -1);
} catch (GameActionException e) {
e.printStackTrace();
}
}