Last active
February 15, 2019 08:37
-
-
Save omidekz/1bc357fb67e5d214a1dd985688617c6a to your computer and use it in GitHub Desktop.
print map of SharifAI2019
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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