Skip to content
Snippets Groups Projects
Commit 8f953d15 authored by steyer's avatar steyer
Browse files

Json

parent 4503fe0b
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ public class GameBoardJson {
for (int i = 0; i < height; i++) {
JsonArray currentRow = rows.getJsonArray(i);
for (int j = 0; j < width; j++) {
boolean currentCellAlive = currentRow.getBoolean(j);
boolean currentCellAlive = currentRow.getString(j).equals("+");
if (currentCellAlive)
board.get(i,j).setAlive(true);
}
......@@ -37,12 +37,16 @@ public class GameBoardJson {
for (int i = 0; i < height; i++) {
JsonArrayBuilder currentRow = Json.createArrayBuilder();
for (int j = 0; j < width; j++) {
currentRow.add(board.get(i, j).isAlive());
if (board.get(i, j).isAlive()){
currentRow.add("+");
} else {
currentRow.add("-");
}
}
rowsBuilder.add(currentRow.build());
}
JsonObject boardObject = Json.createObjectBuilder() //TODO többsoros
JsonObject boardObject = Json.createObjectBuilder()
.add("file", destination.getName())
.add("size",
Json.createObjectBuilder()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment