From 8f953d15877420be6a53145910906beacae345ce Mon Sep 17 00:00:00 2001 From: steyer <steyer10@gmail.com> Date: Mon, 9 Dec 2019 20:40:31 +0100 Subject: [PATCH] Json --- src/game/GameBoardJson.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/game/GameBoardJson.java b/src/game/GameBoardJson.java index 0a3d62f..b0cc304 100644 --- a/src/game/GameBoardJson.java +++ b/src/game/GameBoardJson.java @@ -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() -- GitLab