Skip to content

Instantly share code, notes, and snippets.

@omidekz
Last active February 15, 2019 08:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omidekz/1bc357fb67e5d214a1dd985688617c6a to your computer and use it in GitHub Desktop.
Save omidekz/1bc357fb67e5d214a1dd985688617c6a to your computer and use it in GitHub Desktop.
print map of SharifAI2019
private static final String OBJECTIVEZONE_SHAPE = "# ",
OPP_RESPAWNZONE_SHAPE = "+' ",
MY_RESPAWNZONE_SHAPE = "+ ",
WALL_SHAPE = "/\\ ",
NORMAL_CELL = "-- ";
static void printMap(World world) {
Cell[][] cells = world.getMap().getCells();
System.out.print(" ");
for (int i = 0; i < world.getMap().getColumnNum(); i++) {
String str = String.valueOf(i);
System.out.print(str+(str.length()==1?" ":" "));
}
System.out.println();
for (int i = 0; i < world.getMap().getRowNum(); i++) {
String str=String.valueOf(i);
System.out.print(str+(str.length()==1?" ":""));
for (int j = 0; j < world.getMap().getColumnNum(); j++) {
Hero inThisCell = world.getMyHero(cells[i][j]);
Hero oppInThisCell = world.getOppHero(cells[i][j]);
System.out.print(
oppInThisCell!=null?String.format( "%s' ",oppInThisCell.getName().name().charAt(0)):
inThisCell!=null?String.format( "%s ",inThisCell.getName().name().charAt(0)):
cells[i][j].isWall() ? WALL_SHAPE:
cells[i][j].isInMyRespawnZone() ? MY_RESPAWNZONE_SHAPE :
cells[i][j].isInOppRespawnZone() ? OPP_RESPAWNZONE_SHAPE :
cells[i][j].isInObjectiveZone() ? OBJECTIVEZONE_SHAPE :
NORMAL_CELL);
}
System.out.println();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment