From f240ecf5f0dae6540ec892eb4e1618b9079c3cf4 Mon Sep 17 00:00:00 2001 From: Arne Keller Date: Fri, 28 Feb 2020 11:56:17 +0100 Subject: [PATCH] Correct list-buildings order --- game1_input.txt | 3 +++ game1_output.txt | 4 ++++ src/edu/kit/informatik/ui/command/ListBuildings.java | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/game1_input.txt b/game1_input.txt index eb4ab3a..b712047 100644 --- a/game1_input.txt +++ b/game1_input.txt @@ -64,6 +64,7 @@ tiger tiger thunderstorm list-resources +list-buildings draw draw draw @@ -116,4 +117,6 @@ list-resources build? build steamboat build fireplace +build axe +list-buildings build steamboat diff --git a/game1_output.txt b/game1_output.txt index 0ab4313..b55ec75 100644 --- a/game1_output.txt +++ b/game1_output.txt @@ -1,5 +1,6 @@ OK EMPTY +EMPTY wood wood wood @@ -107,3 +108,6 @@ steamboat Error, need fireplace to build OK OK +axe +fireplace +OK diff --git a/src/edu/kit/informatik/ui/command/ListBuildings.java b/src/edu/kit/informatik/ui/command/ListBuildings.java index abaf235..2d382d1 100644 --- a/src/edu/kit/informatik/ui/command/ListBuildings.java +++ b/src/edu/kit/informatik/ui/command/ListBuildings.java @@ -16,7 +16,9 @@ public class ListBuildings extends Command { if (items.isEmpty()) { Terminal.printLine("EMPTY"); } else { - items.forEach(Terminal::printLine); + for (int i = items.size() - 1; i >= 0; i--) { + Terminal.printLine(items.get(i)); + } } }