diff --git a/Backend_Fang_den_Hut/.idea/.gitignore b/Backend_Fang_den_Hut/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..13566b81b018ad684f3a35fee301741b2734c8f4 --- /dev/null +++ b/Backend_Fang_den_Hut/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Backend_Fang_den_Hut/.idea/description.html b/Backend_Fang_den_Hut/.idea/description.html new file mode 100644 index 0000000000000000000000000000000000000000..db5f12955691506605c7b50297b402dd1489554d --- /dev/null +++ b/Backend_Fang_den_Hut/.idea/description.html @@ -0,0 +1 @@ +<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html> \ No newline at end of file diff --git a/Backend_Fang_den_Hut/.idea/encodings.xml b/Backend_Fang_den_Hut/.idea/encodings.xml new file mode 100644 index 0000000000000000000000000000000000000000..97626ba45445dc9f3afa66e6a149914dc39e3df6 --- /dev/null +++ b/Backend_Fang_den_Hut/.idea/encodings.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="Encoding"> + <file url="PROJECT" charset="UTF-8" /> + </component> +</project> \ No newline at end of file diff --git a/Backend_Fang_den_Hut/.idea/misc.xml b/Backend_Fang_den_Hut/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..c3126227d7b4a9938966da99c6d5dbb00b3d3b9a --- /dev/null +++ b/Backend_Fang_den_Hut/.idea/misc.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectKey"> + <option name="state" value="project://e2804f05-5315-4fc6-a121-c522a6c26470" /> + </component> + <component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true" project-jdk-name="15" project-jdk-type="JavaSDK"> + <output url="file://$PROJECT_DIR$/out" /> + </component> + <component name="ProjectType"> + <option name="id" value="jpab" /> + </component> +</project> \ No newline at end of file diff --git a/Backend_Fang_den_Hut/.idea/modules.xml b/Backend_Fang_den_Hut/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..dfac7b4c9dba0510c14145647dfe5e5ff20a8170 --- /dev/null +++ b/Backend_Fang_den_Hut/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/Backend_Fang_den_Hut.iml" filepath="$PROJECT_DIR$/Backend_Fang_den_Hut.iml" /> + </modules> + </component> +</project> \ No newline at end of file diff --git a/Backend_Fang_den_Hut/.idea/project-template.xml b/Backend_Fang_den_Hut/.idea/project-template.xml new file mode 100644 index 0000000000000000000000000000000000000000..1f08b88792b9888be9616fef9c5b20a92251d6e1 --- /dev/null +++ b/Backend_Fang_den_Hut/.idea/project-template.xml @@ -0,0 +1,3 @@ +<template> + <input-field default="com.company">IJ_BASE_PACKAGE</input-field> +</template> \ No newline at end of file diff --git a/Backend_Fang_den_Hut/Backend_Fang_den_Hut.iml b/Backend_Fang_den_Hut/Backend_Fang_den_Hut.iml new file mode 100644 index 0000000000000000000000000000000000000000..c90834f2d607afe55e6104d8aa2cdfffb713f688 --- /dev/null +++ b/Backend_Fang_den_Hut/Backend_Fang_den_Hut.iml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module> \ No newline at end of file diff --git a/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Game.class b/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Game.class new file mode 100644 index 0000000000000000000000000000000000000000..04601eae8df203785d04b21f53ce89b2ebbb2875 Binary files /dev/null and b/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Game.class differ diff --git a/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Gamechar.class b/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Gamechar.class new file mode 100644 index 0000000000000000000000000000000000000000..a16344c560f7fb9f70921d44060adc7c3e2d10a2 Binary files /dev/null and b/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Gamechar.class differ diff --git a/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Main.class b/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..1df25f5a7b516b273ecbb04dfacc698e59dc12c2 Binary files /dev/null and b/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Main.class differ diff --git a/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Spielfeld.class b/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Spielfeld.class new file mode 100644 index 0000000000000000000000000000000000000000..3c414426df1edb96761aa9f86ae5b3bbf18568c6 Binary files /dev/null and b/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Spielfeld.class differ diff --git a/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Team.class b/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Team.class new file mode 100644 index 0000000000000000000000000000000000000000..ef1e43221275e3b7d73c2008762134a8404aa849 Binary files /dev/null and b/Backend_Fang_den_Hut/out/production/Backend_Fang_den_Hut/com/company/Team.class differ diff --git a/Backend_Fang_den_Hut/src/com/company/Game.java b/Backend_Fang_den_Hut/src/com/company/Game.java new file mode 100644 index 0000000000000000000000000000000000000000..088a422c46fc71793cf8795d119998e3444dd859 --- /dev/null +++ b/Backend_Fang_den_Hut/src/com/company/Game.java @@ -0,0 +1,371 @@ +package com.company; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Iterator; +import java.util.LinkedList; + +public class Game { + + public void redmoveleft(Gamechar gamechar, int wuerfel, LinkedList<String> outterring) { + //Red moves in outter Ring left + //es wird geprueft ob sich die erste Figur noch in der basis befindet + //Wenn sie das tut läuft sie von dort los + //0 tes feld des rings wird mit 1 erreicht + if (gamechar.color == "red" && gamechar.id == 0) { + String s = outterring.get(53 - wuerfel); + outterring.set(53 - wuerfel, "charred" + s); + gamechar.id = 53 - wuerfel; + + } + //Figur befindet sich nicht mehr in der Basis + //Läuft von aktueller position weiter + else { + if (gamechar.color == "red" && gamechar.id != 0) { + String t = outterring.get(gamechar.id); + if (t.contains("rest")) { + outterring.set(gamechar.id, "rest"); + } else { + if (t.contains("infrontofredbase")) { + outterring.set(gamechar.id, "infrontofredbase"); + } else { + outterring.set(gamechar.id, "" + gamechar.id); + String u = outterring.get(gamechar.id - wuerfel); + outterring.set(gamechar.id - wuerfel, "charred" + u); + gamechar.id = gamechar.id - wuerfel; + } + } + + } + //es wird der extremfall abgefangen index out of linked list + if (gamechar.id - wuerfel < 0) { + //hilfsvariable speichert den wert wo die figur stehen soll + //hilfsvariable wird dann benutzt um den hut am gewünschten fel zu platzieren + int hilf = (gamechar.id - wuerfel); + outterring.set(51 + hilf, "charred"); + gamechar.id = 51 + hilf; + } else { + outterring.set(gamechar.id - wuerfel, "charred"); + gamechar.id = gamechar.id - wuerfel; + } + } + + + } + + public void greenmoveleft(Gamechar gamechar, int wuerfel, LinkedList<String> outterring) { + //green moves in outter Ring left + //es wird geprueft ob sich die erste Figur noch in der basis befindet + //Wenn sie das tut läuft sie von dort los + if (gamechar.color == "green" && gamechar.id == 0) { + String s = outterring.get(15 - wuerfel); + outterring.set(15 - wuerfel, "chargreen" + s); + gamechar.id = 15 - wuerfel; + } + //Figur befindet sich nicht mehr in der Basis + //Läuft von aktueller position weiter + else { + if (gamechar.color == "green" && gamechar.id != 0) { + String t = outterring.get(gamechar.id); + if (t.contains("rest")) { + outterring.set(gamechar.id, "rest"); + } else { + if (t.contains("infrontofgreenbase")) { + outterring.set(gamechar.id, "infrontofgreenbase"); + } else { + outterring.set(gamechar.id, "" + gamechar.id); + String u = outterring.get(gamechar.id - wuerfel); + outterring.set(gamechar.id - wuerfel, "chargreen" + u); + gamechar.id = gamechar.id - wuerfel; + } + } + } + //es wird der extremfall abgefangen index out of linked list + if (gamechar.id - wuerfel < 0) { + //hilfsvariable speichert den wert wo die figur stehen soll + //hilfsvariable wird dann benutzt um den hut am gewünschten fel zu platzieren + int hilf = (gamechar.id - wuerfel); + outterring.set(51 + hilf, "chargreen"); + gamechar.id = 51 + hilf; + } else { + outterring.set(gamechar.id - wuerfel, "chargreen"); + gamechar.id = gamechar.id - wuerfel; + } + } + + } + + public void yellowmoveleft(Gamechar gamechar, int wuerfel, LinkedList<String> outterring) { + //yellow moves in outter Ring left + //es wird geprueft ob sich die erste Figur noch in der basis befindet + //Wenn sie das tut läuft sie von dort los + if (gamechar.color == "yellow" && gamechar.id == 0) { + String s = outterring.get(27 - wuerfel); + outterring.set(27 - wuerfel, "charyellow" + s); + gamechar.id = 27 - wuerfel; + } + //Figur befindet sich nicht mehr in der Basis + //Läuft von aktueller position weiter + else { + if (gamechar.color == "yellow" && gamechar.id != 0) { + //aktuellen stand zwischenspeichern + String t = outterring.get(gamechar.id); + //Ruhebank + if (t.contains("rest")) { + outterring.set(gamechar.id, "rest"); + } else { + if (t.contains("infrontofyellowbase")) { + outterring.set(gamechar.id, "infrontofyellowbase"); + } else { + outterring.set(gamechar.id, "" + gamechar.id); + String u = outterring.get(gamechar.id - wuerfel); + outterring.set(gamechar.id - wuerfel, "charyellow" + u); + gamechar.id = gamechar.id - wuerfel; + } + } + + + } + //es wird der extremfall abgefangen index out of linked list + if (gamechar.id - wuerfel < 0) { + //hilfsvariable speichert den wert wo die figur stehen soll + //hilfsvariable wird dann benutzt um den hut am gewünschten fel zu platzieren + int hilf = (gamechar.id - wuerfel); + outterring.set(51 + hilf, "charyellow"); + gamechar.id = 51 + hilf; + } else { + outterring.set(gamechar.id - wuerfel, "charyellow"); + gamechar.id = gamechar.id - wuerfel; + } + } + } + + + public void bluemovesleft(Gamechar gamechar, int wuerfel, LinkedList<String> outterring) { + //blue moves in outter Ring left + //es wird geprueft ob sich die erste Figur noch in der basis befindet + //Wenn sie das tut läuft sie von dort los + if (gamechar.color == "blue" && gamechar.id == 0) { + String s = outterring.get(40 - wuerfel); + outterring.set(40 - wuerfel, "charblue" + s); + gamechar.id = 40 - wuerfel; + } + //Figur befindet sich nicht mehr in der Basis + //Läuft von aktueller position weiter + else { + if (gamechar.color == "blue" && gamechar.id != 0) { + + String t = outterring.get(gamechar.id); + if (t.contains("rest")) { + outterring.set(gamechar.id, "rest"); + } else { + if (t.contains("infrontofbluebase")) { + outterring.set(gamechar.id, "infrontofbluebase"); + } else { + outterring.set(gamechar.id, "" + gamechar.id); + String u = outterring.get(gamechar.id - wuerfel); + outterring.set(gamechar.id - wuerfel, "charblue" + u); + gamechar.id = gamechar.id - wuerfel; + } + } + + + } + + //es wird der extremfall abgefangen index out of linked list + if (gamechar.id - wuerfel < 0) { + //hilfsvariable speichert den wert wo die figur stehen soll + //hilfsvariable wird dann benutzt um den hut am gewünschten fel zu platzieren + int hilf = (gamechar.id - wuerfel); + outterring.set(51 + hilf, "charblue"); + gamechar.id = 51 + hilf; + } else { + outterring.set(gamechar.id - wuerfel, "charblue"); + gamechar.id = gamechar.id - wuerfel; + } + } + } + + +//nach rechts auf dem außeren ring bewegen + + + public void redmoveright(Gamechar gamechar, int wuerfel, LinkedList<String> outterring) { + //Red moves in outter Ring right + //Wenn id 0 hut befindet sich in basis kann von seiner basis aus loslaufen + if (gamechar.color == "red" && gamechar.id == 0) { + String s = outterring.get(-1 + wuerfel); + outterring.set(-1 + wuerfel, s + "charred"); + gamechar.id = 0 + wuerfel; + } else { + //Wenn id nicht null hut befindet sich bereits auf Spielfeld + if (gamechar.color == "red" && gamechar.id != 0) { + outterring.set(gamechar.id, "" + gamechar.id); + } + //Ueberlauf abfangen + if (gamechar.id + wuerfel > 51) { + int hilf = (gamechar.id + wuerfel) - 51; + outterring.set(hilf - 1, "charred"); + gamechar.id = hilf - 1; + } else { + outterring.set(gamechar.id + wuerfel, "charred"); + gamechar.id = gamechar.id + wuerfel; + } + } + + + } + + public void greenmoveright(Gamechar gamechar, int wuerfel, LinkedList<String> outterring) { + //Green moves in outter Ring righgt + //Wenn id 0 hut befindet sich in basis kann von seiner basis aus loslaufen + if (gamechar.color == "green" && gamechar.id == 0) { + outterring.set(12 + wuerfel, "charred"); + gamechar.id = 12 + wuerfel; + } else { + //Wenn id nicht null hut befindet sich bereits auf Spielfeld + if (gamechar.color == "green" && gamechar.id != 0) { + outterring.set(gamechar.id, "" + gamechar.id); + } + //Ueberlauf abfangen + if (gamechar.id + wuerfel > 51) { + int hilf = (gamechar.id + wuerfel) - 51; + outterring.set(hilf - 1, "chargreen"); + gamechar.id = hilf - 1; + } else { + outterring.set(gamechar.id + wuerfel, "chargreen"); + gamechar.id = gamechar.id + wuerfel; + } + } + } + + public void yellowmoveright(Gamechar gamechar, int wuerfel, LinkedList<String> outterring) { + //Yellow moves in outter Ring righgt + //Wenn id 0 hut befindet sich in basis kann von seiner basis aus loslaufen + if (gamechar.color == "yellow" && gamechar.id == 0) { + outterring.set(25 + wuerfel, "charyellow"); + gamechar.id = 25 + wuerfel; + } else { + //Wenn id nicht null hut befindet sich bereits auf Spielfeld + if (gamechar.color == "yellow" && gamechar.id != 0) { + outterring.set(gamechar.id, "" + gamechar.id); + } + //Ueberlauf abfangen + if (gamechar.id + wuerfel > 51) { + int hilf = (gamechar.id + wuerfel) - 51; + outterring.set(hilf - 1, "charyellow"); + gamechar.id = hilf - 1; + } else { + outterring.set(gamechar.id + wuerfel, "charyellow"); + gamechar.id = gamechar.id + wuerfel; + } + } + } + + public void bluemoveright(Gamechar gamechar, int wuerfel, LinkedList<String> outterring) { + //blue moves in outter Ring righgt + //Wenn id 0 hut befindet sich in basis kann von seiner basis aus loslaufen + if (gamechar.color == "blue" && gamechar.id == 0) { + outterring.set(38 + wuerfel, "charblue"); + gamechar.id = 38 + wuerfel; + } else { + //Wenn id nicht null hut befindet sich bereits auf Spielfeld + if (gamechar.color == "blue" && gamechar.id != 0) { + outterring.set(gamechar.id, "" + gamechar.id); + } + //Ueberlauf abfangen + if (gamechar.id + wuerfel > 51) { + int hilf = (gamechar.id + wuerfel) - 51; + outterring.set(hilf - 1, "charblue"); + gamechar.id = hilf - 1; + } else { + outterring.set(gamechar.id + wuerfel, "charblue"); + gamechar.id = gamechar.id + wuerfel; + } + } + } + + public void redmovesstraight(Gamechar gamechar, int wuerfel, LinkedList<String> redtoyellow, LinkedList<String> bluetogreen,LinkedList<String>outterring) throws IOException { + //Wenn Spielfigur noch in Basis + if (gamechar.id == 0 && gamechar.color == "red" && wuerfel > 1) { + String s = redtoyellow.get(-2 + wuerfel); + redtoyellow.set(-2 + wuerfel, "charred" + s); + gamechar.id = -2 + wuerfel; + + } else { + //Wenn sich char nicht mehr in der Basis befindet + } + if (gamechar.color == "red" && gamechar.id != 0) { + String t = redtoyellow.get(gamechar.id); + if (t.contains("rest")) { + redtoyellow.set(gamechar.id, "rest"); + } else { + redtoyellow.set(gamechar.id, "" + gamechar.id); + String u = redtoyellow.get(gamechar.id + wuerfel); + redtoyellow.set(gamechar.id +wuerfel, "charred" + u); + gamechar.id = gamechar.id +wuerfel; + + } + //Überlauf bedeutet entweder nach links in den äußerenring oder nach rechts + if (gamechar.id + wuerfel > 12) { + int hilf = gamechar.id+wuerfel-12; + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + System.out.println("In welche Richtung wollen Sie gehen?: "); + String str = br.readLine(); + if(str=="r"){ + gamechar.id =26; + redmoveleft(gamechar,hilf,outterring); + } + else + { + if(str=="l"){ + gamechar.id=28; + redmoveleft(gamechar,hilf,outterring); + } + else{ + throw new IOException("falsche Eingabe"); + } + } + + } else { + if (gamechar.id + wuerfel > 6) { + int hilf = gamechar.id+wuerfel-6; + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + System.out.println("In welche Richtung wollen Sie gehen?: "); + String str = br.readLine(); + //rechts kommt in die liste bluetogreen + if(str=="r"){ + gamechar.id =6; + ; + } + else + { + //blue to green + if(str=="l"){ + gamechar.id=6; + redmoveleft(gamechar,hilf,outterring); + } + else{ + //geradeaus weiter + if(str=="s"){ + redmovesstraight(gamechar,hilf,redtoyellow,bluetogreen,outterring); + } + else{ + //weder l r noch s eingegeben + throw new IOException("falsche Eingabe"); + } + } + + } + } + //kommt an keine Kreuzung und lauft einfach geradeaus weiter + outterring.set(gamechar.id + wuerfel, "charred"); + gamechar.id = gamechar.id + wuerfel; + } + + + } + + } +} diff --git a/Backend_Fang_den_Hut/src/com/company/Gamechar.java b/Backend_Fang_den_Hut/src/com/company/Gamechar.java new file mode 100644 index 0000000000000000000000000000000000000000..1de9f4f52a9d7407c3cbb7e90472a735d8551e33 --- /dev/null +++ b/Backend_Fang_den_Hut/src/com/company/Gamechar.java @@ -0,0 +1,27 @@ +package com.company; + +public class Gamechar { + int id; + String color; + + public Gamechar(int id,String color){ + this.id=id; + this.color=color; + } + + public String getColor() { + return color; + } + + public int getId() { + return id; + } + + @Override + public String toString() { + return "Gamechar{" + + "id=" + id + + ", color='" + color + '\'' + + '}'; + } +} diff --git a/Backend_Fang_den_Hut/src/com/company/Main.java b/Backend_Fang_den_Hut/src/com/company/Main.java new file mode 100644 index 0000000000000000000000000000000000000000..0066f058ce9449133bad01b2f0cff3d816c35adf --- /dev/null +++ b/Backend_Fang_den_Hut/src/com/company/Main.java @@ -0,0 +1,109 @@ +package com.company; + +import java.io.IOException; +import java.util.LinkedList; + +public class Main { + + public static void main(String[] args) throws IOException { + + //outter Ring test + Spielfeld spiel=new Spielfeld(); + LinkedList outterring; + LinkedList redtoyellow; + LinkedList bluetogreen; + + outterring=spiel.outterRing(); + System.out.println("outterring before initialize\n"+outterring); + outterring=spiel.initializeOutterring(outterring); + System.out.println("outterring after initialize\n"+outterring); + System.out.println("\n"); + //connect redtoyellow + redtoyellow=spiel.connectredtoyellow(); + System.out.println("redtoyellow before initialize\n"+redtoyellow); + bluetogreen=spiel.connectbluetogreen(); + System.out.println("bluetogreen before initialize:\n"+bluetogreen); + System.out.println("\n"); + redtoyellow=spiel.initializeredtoyellow(redtoyellow); + System.out.println("redtoyellow after initialize\n"+redtoyellow); + bluetogreen=spiel.initializebluetogreen(bluetogreen); + System.out.println("greentoblue after initialize\n"+bluetogreen); + System.out.println("\n"); + + + + //Farbe rot + Gamechar charonered=new Gamechar(0,"red"); + Gamechar chartwored=new Gamechar(0,"red"); + Gamechar charthreered=new Gamechar(0,"red"); + Gamechar charfourred=new Gamechar(0,"red"); + + //TEAM RED + Team teamred=new Team(charonered,chartwored,charthreered,charfourred,0,"red"); + System.out.println(teamred); + int wuerfel=teamred.wuerfeln(); + System.out.println("Team rot hat eine "+wuerfel+"gewuerfelt"); + System.out.println("\n"); + //test auf dem aeußeren Ring bewegen + Game game=new Game(); + game.redmovesstraight(teamred.char1,wuerfel,redtoyellow,bluetogreen,outterring); + System.out.println("retdoyellow after red moves "+redtoyellow); + System.out.println("\n"); + wuerfel= teamred.wuerfeln(); + System.out.println("Team rot hat eine "+wuerfel+"gewuerfelt"); + System.out.println("\n"); + game.redmovesstraight(teamred.char1,wuerfel,redtoyellow,bluetogreen,outterring);; + System.out.println("\n"); + System.out.println("redtoyellow after red moves "+redtoyellow); + + + + //Farbe blue + Gamechar charoneblue=new Gamechar(0,"blue"); + Gamechar chartwoblue=new Gamechar(0,"blue"); + Gamechar charthreeblue=new Gamechar(0,"blue"); + Gamechar charfourblue=new Gamechar(0,"blue"); + + //TEam blue + Team teamblue=new Team(charoneblue,chartwoblue,charthreeblue,charfourblue,0,"blue"); + wuerfel= teamblue.wuerfeln(); + System.out.println("Team Blue hat eine "+wuerfel+"gewuerfelt"); + System.out.println("\n"); + game.bluemoveright(teamblue.char1,wuerfel,outterring); + System.out.println("\n"); + System.out.println("outterring after blue moves "+outterring); + //Farbe green + Gamechar charonegreen=new Gamechar(0,"green"); + Gamechar chartwogreen=new Gamechar(0,"green"); + Gamechar charthreegreen=new Gamechar(0,"green"); + Gamechar charfourgreen=new Gamechar(0,"green"); + + + + //TEam green + Team teamgreen= new Team(charonegreen,chartwogreen,charthreegreen,charfourgreen,0,"green"); + + wuerfel= teamgreen.wuerfeln(); + System.out.println("Team Green hat eine "+wuerfel+"gewuerfelt"); + //Farbe gelb + Gamechar charoneyellow=new Gamechar(0,"yellow"); + Gamechar chartwoyellow=new Gamechar(0,"yellow"); + Gamechar charthreeyellow=new Gamechar(0,"yellow"); + Gamechar charfouryellow=new Gamechar(0,"yellow"); + + //Team Yellow + Team teamyellow= new Team(charoneyellow,chartwoyellow,charthreeyellow,charfouryellow,0,"yellow"); + wuerfel= teamyellow.wuerfeln(); + System.out.println("Team Yellow hat eine "+wuerfel+"gewuerfelt"); + + + + + + + + + + + } +} diff --git a/Backend_Fang_den_Hut/src/com/company/Spielfeld.java b/Backend_Fang_den_Hut/src/com/company/Spielfeld.java new file mode 100644 index 0000000000000000000000000000000000000000..083da4b44523e8de31277dbbde5c18ba00602a56 --- /dev/null +++ b/Backend_Fang_den_Hut/src/com/company/Spielfeld.java @@ -0,0 +1,67 @@ +package com.company; + +import java.util.Iterator; +import java.util.LinkedList; + +public class Spielfeld { + + LinkedList <String> ring=new LinkedList(); + LinkedList <String> connectredtoyellow=new LinkedList<>(); + LinkedList <String> connectbluetogreen=new LinkedList<>(); + + public LinkedList outterRing(){ + for (int i=0;i<=51;i++){ + ring.add(""+i); + } + return ring; + } + public LinkedList<String> initializeOutterring(LinkedList <String> ring){ + ring.set(0, "infrontofredbase"); + ring.set(3, "rest"); + ring.set(10,"rest"); + ring.set(13,"infrontofgreenbase"); + ring.set(16,"rest"); + ring.set(23,"rest"); + ring.set(26,"infrontofyellowbase"); + ring.set(29,"rest"); + ring.set(36,"rest"); + ring.set(39,"infrontofbluebase"); + ring.set(42,"rest"); + ring.set(49,"rest"); + + return ring; + } + public LinkedList connectredtoyellow(){ + for (int i=0;i<=12;i++){ + connectredtoyellow.add(""+i); + } + return connectredtoyellow; + } + public LinkedList<String> initializeredtoyellow(LinkedList<String>connectredtoyellow){ + connectredtoyellow.set(2,"rest"); + connectredtoyellow.set(10,"rest"); + + return connectredtoyellow; + } + + public LinkedList connectbluetogreen(){ + for (int i=0;i<=12;i++){ + connectbluetogreen.add(""+i); + } + return connectbluetogreen; + } + public LinkedList<String> initializebluetogreen(LinkedList<String>connectbluetogreen){ + connectbluetogreen.set(2,"rest"); + connectbluetogreen.set(10,"rest"); + + return connectbluetogreen; + } + + + + + + + } + + diff --git a/Backend_Fang_den_Hut/src/com/company/Team.java b/Backend_Fang_den_Hut/src/com/company/Team.java new file mode 100644 index 0000000000000000000000000000000000000000..c2ff3a15ec347a5e5b082f611ebc582514d3e270 --- /dev/null +++ b/Backend_Fang_den_Hut/src/com/company/Team.java @@ -0,0 +1,38 @@ +package com.company; + +import java.util.Random; + +public class Team extends Gamechar { + Gamechar char1; + Gamechar char2; + Gamechar char3; + Gamechar char4; + + + + public Team(Gamechar char1, Gamechar char2, Gamechar char3, Gamechar char4, int id, String color) { + super(id,color); + + this.char1=char1; + this.char2=char2; + this.char3=char3; + this.char4=char4; + } + //generiert random zahl zwischen >=0 und <7 + public int wuerfeln(){ + Random rand=new Random(); + int wuerfelzahl= rand.nextInt(6); + //Da es keine null geben soll + return wuerfelzahl+1; + } + + @Override + public String toString() { + return "Team{" + + "char1=" + char1 + + ", char2=" + char2 + + ", char3=" + char3 + + ", char4=" + char4 + + '}'; + } +}