diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java index 105d319..67a737f 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java @@ -123,41 +123,6 @@ public class GameInstance { @Override public String toString() { - StringBuilder sb = new StringBuilder(); - for(int y = 0; y < _state.mapSize.getY(); y++) { - for(int x = 0; x < _state.mapSize.getX(); x++) { - ArrayList entities = _state.entities.findByPosition(new IntVector2(x, y)); - if(entities.isEmpty()) { - sb.append(". "); - }else { - switch(entities.get(0).id.type) { - case NPC -> { - switch(entities.get(0).id.id) { - case 0 -> { - sb.append("G "); - } - case 1 -> { - sb.append("S "); - } - case 2 -> { - sb.append("T "); - } - } - } - case P1, P2 -> { - sb.append("X "); - } - case Rocks -> { - sb.append("O "); - } - case InfinityStones -> { - sb.append("# "); - } - } - } - } - sb.append("\n"); - } - return sb.toString(); + return _state.toString(); } } diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameState.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameState.java index 98d89e6..99e7174 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameState.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameState.java @@ -118,4 +118,44 @@ class GameState { winConditions.cloneFrom(state.winConditions); } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + for(int y = 0; y < mapSize.getY(); y++) { + for(int x = 0; x < mapSize.getX(); x++) { + ArrayList entities = this.entities.findByPosition(new IntVector2(x, y)); + if(entities.isEmpty()) { + sb.append(". "); + }else { + switch(entities.get(0).id.type) { + case NPC -> { + switch(entities.get(0).id.id) { + case 0 -> { + sb.append("G "); + } + case 1 -> { + sb.append("S "); + } + case 2 -> { + sb.append("T "); + } + } + } + case P1, P2 -> { + sb.append("X "); + } + case Rocks -> { + sb.append("O "); + } + case InfinityStones -> { + sb.append("# "); + } + } + } + } + sb.append("\n"); + } + return sb.toString(); + } }