forked from IF-LK-2020/wordle
Merge branch 'main' of https://git.ngb.schule/Tim/wordle
This commit is contained in:
@@ -1,20 +1,65 @@
|
|||||||
public class Game {
|
public class Game {
|
||||||
// Instanzvariablen - ersetzen Sie das folgende Beispiel mit Ihren Variablen
|
// Instanzvariablen - ersetzen Sie das folgende Beispiel mit Ihren Variablen
|
||||||
WordleServer wordleServer;
|
WordleServer wordleServer;
|
||||||
User user;
|
User user;
|
||||||
DatabaseConnector databaseConnector;// Datenbankverbindung aufstellen
|
static DatabaseConnector databaseConnector;// Datenbankverbindung aufstellen
|
||||||
private String wordle;
|
|
||||||
private String[] words;
|
|
||||||
private int count;
|
|
||||||
|
|
||||||
public Game(WordleServer wordleServer) {
|
private String ip;
|
||||||
|
private int port;
|
||||||
|
|
||||||
this.wordleServer = wordleServer;
|
private String wordle;
|
||||||
|
private String[] words;
|
||||||
|
private int count;
|
||||||
|
private int phase;
|
||||||
|
|
||||||
user = new User();
|
public Game(WordleServer wordleServer, String pClientIP, int pClientPort) {
|
||||||
}
|
|
||||||
|
|
||||||
public void processMessage(String msg) {
|
this.wordleServer = wordleServer;
|
||||||
System.out.println(msg);
|
this.ip = pClientIP;
|
||||||
}
|
this.port = pClientPort;
|
||||||
|
|
||||||
|
user = new User();
|
||||||
|
|
||||||
|
send("+OK Hello there");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void processMessage(String msg) {
|
||||||
|
|
||||||
|
if (msg.equals("quit")) {
|
||||||
|
send("+OK bye");
|
||||||
|
wordleServer.closeConnection(ip, port);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (phase) {
|
||||||
|
case 0:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void send(String msg) {
|
||||||
|
wordleServer.send(ip, port, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIp() {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIp(String ip) {
|
||||||
|
this.ip = ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPort() {
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPort(int port) {
|
||||||
|
this.port = port;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,18 +29,28 @@ public class WordleServer extends Server {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processNewConnection( String pClientIP, int pClientPort ) {
|
public void processNewConnection( String pClientIP, int pClientPort ) {
|
||||||
games.append(new Game(this));
|
games.append(new Game(this, pClientIP, pClientPort));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processClosingConnection( String pClientIP, int pClientPort ) {
|
public void processClosingConnection( String pClientIP, int pClientPort ) {
|
||||||
System.out.println("Closed connection: " + pClientPort);
|
find(pClientIP, pClientPort);
|
||||||
|
games.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processMessage( String pClientIP, int pClientPort, String pMessage ) {
|
public void processMessage( String pClientIP, int pClientPort, String pMessage ) {
|
||||||
games.toFirst();
|
find(pClientIP, pClientPort).processMessage(pMessage);
|
||||||
games.getContent().processMessage(pMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Game find(String ip, int port) {
|
||||||
|
games.toFirst();
|
||||||
|
while (games.hasAccess()) {
|
||||||
|
Game g = games.getContent();
|
||||||
|
if (g.getIp().equals(ip) && g.getPort() == port) {
|
||||||
|
return g;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
145
umlet.uxf
145
umlet.uxf
@@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<diagram program="umlet" version="14.3.0">
|
<diagram program="umlet" version="14.3.0">
|
||||||
<zoom_level>12</zoom_level>
|
<zoom_level>8</zoom_level>
|
||||||
<element>
|
<element>
|
||||||
<id>UMLClass</id>
|
<id>UMLClass</id>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>636</x>
|
<x>936</x>
|
||||||
<y>144</y>
|
<y>208</y>
|
||||||
<w>120</w>
|
<w>80</w>
|
||||||
<h>36</h>
|
<h>24</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>Server</panel_attributes>
|
<panel_attributes>Server</panel_attributes>
|
||||||
<additional_attributes/>
|
<additional_attributes/>
|
||||||
@@ -15,10 +15,10 @@
|
|||||||
<element>
|
<element>
|
||||||
<id>UMLClass</id>
|
<id>UMLClass</id>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>636</x>
|
<x>936</x>
|
||||||
<y>300</y>
|
<y>312</y>
|
||||||
<w>120</w>
|
<w>80</w>
|
||||||
<h>36</h>
|
<h>24</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>WordleServer</panel_attributes>
|
<panel_attributes>WordleServer</panel_attributes>
|
||||||
<additional_attributes/>
|
<additional_attributes/>
|
||||||
@@ -26,10 +26,10 @@
|
|||||||
<element>
|
<element>
|
||||||
<id>Relation</id>
|
<id>Relation</id>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>684</x>
|
<x>968</x>
|
||||||
<y>168</y>
|
<y>224</y>
|
||||||
<w>36</w>
|
<w>24</w>
|
||||||
<h>156</h>
|
<h>104</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>lt=<<-</panel_attributes>
|
<panel_attributes>lt=<<-</panel_attributes>
|
||||||
<additional_attributes>10.0;10.0;10.0;110.0</additional_attributes>
|
<additional_attributes>10.0;10.0;10.0;110.0</additional_attributes>
|
||||||
@@ -37,10 +37,10 @@
|
|||||||
<element>
|
<element>
|
||||||
<id>UMLClass</id>
|
<id>UMLClass</id>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>0</x>
|
<x>512</x>
|
||||||
<y>420</y>
|
<y>392</y>
|
||||||
<w>348</w>
|
<w>232</w>
|
||||||
<h>468</h>
|
<h>312</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>User
|
<panel_attributes>User
|
||||||
--
|
--
|
||||||
@@ -72,10 +72,10 @@
|
|||||||
<element>
|
<element>
|
||||||
<id>UMLClass</id>
|
<id>UMLClass</id>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>180</x>
|
<x>632</x>
|
||||||
<y>276</y>
|
<y>296</y>
|
||||||
<w>168</w>
|
<w>112</w>
|
||||||
<h>36</h>
|
<h>24</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>DatabaseConnector</panel_attributes>
|
<panel_attributes>DatabaseConnector</panel_attributes>
|
||||||
<additional_attributes/>
|
<additional_attributes/>
|
||||||
@@ -83,10 +83,10 @@
|
|||||||
<element>
|
<element>
|
||||||
<id>Relation</id>
|
<id>Relation</id>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>684</x>
|
<x>968</x>
|
||||||
<y>324</y>
|
<y>328</y>
|
||||||
<w>144</w>
|
<w>96</w>
|
||||||
<h>120</h>
|
<h>80</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>lt=<.
|
<panel_attributes>lt=<.
|
||||||
-wordleServer</panel_attributes>
|
-wordleServer</panel_attributes>
|
||||||
@@ -95,13 +95,16 @@
|
|||||||
<element>
|
<element>
|
||||||
<id>UMLClass</id>
|
<id>UMLClass</id>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>516</x>
|
<x>856</x>
|
||||||
<y>420</y>
|
<y>392</y>
|
||||||
<w>360</w>
|
<w>240</w>
|
||||||
<h>132</h>
|
<h>88</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>Game
|
<panel_attributes>Game
|
||||||
--
|
--
|
||||||
|
-ip: String
|
||||||
|
-port: int
|
||||||
|
|
||||||
-wordle: String
|
-wordle: String
|
||||||
-words: String[]
|
-words: String[]
|
||||||
-wordCount: int
|
-wordCount: int
|
||||||
@@ -113,24 +116,10 @@
|
|||||||
<element>
|
<element>
|
||||||
<id>UMLClass</id>
|
<id>UMLClass</id>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>1020</x>
|
<x>584</x>
|
||||||
<y>420</y>
|
<y>216</y>
|
||||||
<w>288</w>
|
<w>80</w>
|
||||||
<h>84</h>
|
<h>24</h>
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>GUI
|
|
||||||
--
|
|
||||||
+setLetter(char letter): void
|
|
||||||
+setLetterColor(byte color): void</panel_attributes>
|
|
||||||
<additional_attributes/>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<id>UMLClass</id>
|
|
||||||
<coordinates>
|
|
||||||
<x>108</x>
|
|
||||||
<y>156</y>
|
|
||||||
<w>120</w>
|
|
||||||
<h>36</h>
|
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>QueryResult</panel_attributes>
|
<panel_attributes>QueryResult</panel_attributes>
|
||||||
<additional_attributes/>
|
<additional_attributes/>
|
||||||
@@ -138,10 +127,10 @@
|
|||||||
<element>
|
<element>
|
||||||
<id>Relation</id>
|
<id>Relation</id>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>336</x>
|
<x>736</x>
|
||||||
<y>408</y>
|
<y>384</y>
|
||||||
<w>204</w>
|
<w>136</w>
|
||||||
<h>48</h>
|
<h>32</h>
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>lt=<.
|
<panel_attributes>lt=<.
|
||||||
-user</panel_attributes>
|
-user</panel_attributes>
|
||||||
@@ -150,59 +139,13 @@
|
|||||||
<element>
|
<element>
|
||||||
<id>Relation</id>
|
<id>Relation</id>
|
||||||
<coordinates>
|
<coordinates>
|
||||||
<x>864</x>
|
<x>736</x>
|
||||||
<y>408</y>
|
<y>296</y>
|
||||||
<w>180</w>
|
<w>176</w>
|
||||||
<h>48</h>
|
<h>112</h>
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>lt=<.
|
|
||||||
-gui</panel_attributes>
|
|
||||||
<additional_attributes>130.0;20.0;10.0;20.0</additional_attributes>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<id>Relation</id>
|
|
||||||
<coordinates>
|
|
||||||
<x>336</x>
|
|
||||||
<y>276</y>
|
|
||||||
<w>264</w>
|
|
||||||
<h>168</h>
|
|
||||||
</coordinates>
|
</coordinates>
|
||||||
<panel_attributes>lt=<.
|
<panel_attributes>lt=<.
|
||||||
-databaseConnector</panel_attributes>
|
-databaseConnector</panel_attributes>
|
||||||
<additional_attributes>10.0;20.0;200.0;20.0;200.0;120.0</additional_attributes>
|
<additional_attributes>10.0;20.0;200.0;20.0;200.0;120.0</additional_attributes>
|
||||||
</element>
|
</element>
|
||||||
<element>
|
|
||||||
<id>UMLClass</id>
|
|
||||||
<coordinates>
|
|
||||||
<x>1020</x>
|
|
||||||
<y>0</y>
|
|
||||||
<w>288</w>
|
|
||||||
<h>300</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>Letter
|
|
||||||
--
|
|
||||||
WHITE: byte = -1
|
|
||||||
GRAY: byte = 0
|
|
||||||
YELLOW: byte = 1
|
|
||||||
GREEN: byte = 2
|
|
||||||
|
|
||||||
-letter: char
|
|
||||||
-color: byte
|
|
||||||
--
|
|
||||||
+setColor(byte color): void
|
|
||||||
+getColor(): byte</panel_attributes>
|
|
||||||
<additional_attributes/>
|
|
||||||
</element>
|
|
||||||
<element>
|
|
||||||
<id>Relation</id>
|
|
||||||
<coordinates>
|
|
||||||
<x>1152</x>
|
|
||||||
<y>288</y>
|
|
||||||
<w>156</w>
|
|
||||||
<h>156</h>
|
|
||||||
</coordinates>
|
|
||||||
<panel_attributes>lt=<.
|
|
||||||
-letters: Letter[][]</panel_attributes>
|
|
||||||
<additional_attributes>10.0;10.0;10.0;110.0</additional_attributes>
|
|
||||||
</element>
|
|
||||||
</diagram>
|
</diagram>
|
||||||
|
|||||||
Reference in New Issue
Block a user