From 73fb5d5a4d2be72f52eb67092fa630e284f930a2 Mon Sep 17 00:00:00 2001 From: biryuk <volodymyr.biryuk@uni-hamburg.de> Date: Wed, 29 Nov 2023 17:35:20 +0100 Subject: [PATCH 1/3] Add gitignore Files generated by BlueJ should be ignored bny git. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7be556b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.ctxt +*.class \ No newline at end of file -- GitLab From 87c29122f89e6d3925114acbb8540f8010044fdc Mon Sep 17 00:00:00 2001 From: biryuk <volodymyr.biryuk@uni-hamburg.de> Date: Wed, 29 Nov 2023 18:04:56 +0100 Subject: [PATCH 2/3] Change the order of colors added to FARBEN The order of colors being added to the map now matches the order of the keys in the map. This was necessary because students would get confused when the order given by the .values() method would differ form the addition order. --- Turtle.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Turtle.java b/Turtle.java index 6493655..362d734 100644 --- a/Turtle.java +++ b/Turtle.java @@ -12,6 +12,7 @@ import javax.swing.JFrame; import javax.swing.JPanel; import java.util.HashMap; +import java.util.TreeMap; /** * Diese Klasse definiert Turtles, die mit einfachen @@ -58,19 +59,19 @@ public class Turtle static { FARBEN = new HashMap<String, Color>(); + FARBEN.put("hellgrau", Color.LIGHT_GRAY); + FARBEN.put("magenta", Color.MAGENTA); + FARBEN.put("pink", Color.PINK); + FARBEN.put("gelb", Color.YELLOW); FARBEN.put("schwarz", Color.BLACK); - FARBEN.put("blau", Color.BLUE); + FARBEN.put("weiss", Color.WHITE); FARBEN.put("cyan", Color.CYAN); - FARBEN.put("dunkelgrau", Color.DARK_GRAY); FARBEN.put("grau", Color.GRAY); - FARBEN.put("gruen", Color.GREEN); - FARBEN.put("hellgrau", Color.LIGHT_GRAY); - FARBEN.put("magenta", Color.MAGENTA); + FARBEN.put("blau", Color.BLUE); FARBEN.put("orange", Color.ORANGE); - FARBEN.put("pink", Color.PINK); + FARBEN.put("gruen", Color.GREEN); FARBEN.put("rot", Color.RED); - FARBEN.put("weiss", Color.WHITE); - FARBEN.put("gelb", Color.YELLOW); + FARBEN.put("dunkelgrau", Color.DARK_GRAY); FARB_ARRAY = FARBEN.values().toArray(new Color[FARBEN.size()]); } @@ -82,6 +83,8 @@ public class Turtle public Turtle() { this(TurtleWelt.WIDTH / 2, TurtleWelt.HEIGHT / 2); + System.out.println(FARBEN); + System.out.println(FARBEN.keySet()); } /** -- GitLab From 95e443e731dc4363ca1c5dfe6f86ab084df21139 Mon Sep 17 00:00:00 2001 From: biryuk <volodymyr.biryuk@uni-hamburg.de> Date: Wed, 29 Nov 2023 18:13:20 +0100 Subject: [PATCH 3/3] Clean up code --- Turtle.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Turtle.java b/Turtle.java index 362d734..5f46fdd 100644 --- a/Turtle.java +++ b/Turtle.java @@ -32,7 +32,8 @@ import java.util.TreeMap; * @author Axel Schmolitzky * @author Fredrik Winkler * @author Clara Marie Lueders - * @version 5. Dezember 2018 + * @author Volodymyr Biryuk + * @version 29. November 2023 */ public class Turtle { @@ -83,8 +84,6 @@ public class Turtle public Turtle() { this(TurtleWelt.WIDTH / 2, TurtleWelt.HEIGHT / 2); - System.out.println(FARBEN); - System.out.println(FARBEN.keySet()); } /** -- GitLab