Created
March 11, 2018 06:53
-
-
Save xstrengthofonex/63ef83d75509049d326cddcbcbeaaf36 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 String assembleDirections() { | |
available = new StringBuffer(); | |
nDirections = directions.size(); | |
directionsPlaced = 0; | |
for (String dir: new String[]{Game.NORTH, Game.SOUTH, Game.EAST, Game.WEST}) { | |
if (direction.contains(dir)) { | |
placeDirection(dir); | |
} | |
} | |
} | |
private void placeDirection(String dir) { | |
directionsPlaced++; | |
if (isLastOfMany()) { | |
available.append(" and "); | |
} else if (notFirst()) { | |
available.append(", "); | |
} | |
available.append(directionName(dir)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment