diff --git a/src/Game.java b/src/Game.java index 7991ccb..9d4538f 100644 --- a/src/Game.java +++ b/src/Game.java @@ -103,13 +103,12 @@ public class Game { databaseConnector.executeStatement("SELECT word FROM words WHERE id = " + getWOTDIndex()); QueryResult result = databaseConnector.getCurrentQueryResult(); - System.out.println(databaseConnector.getErrorMessage()); if (result != null && result.getData().length > 0) { wordle = result.getData()[0][0]; phase = GAME_PHASE; send("+OK game ready"); } else { - send("-ERR fatal error: WOTD could not be generated."); + send("-ERR Fatal error: WOTD could not be generated."); } } else if (msg.startsWith("play")) { @@ -125,48 +124,9 @@ public class Game { } private void gamePhase(String msg) { - if (msg.startsWith("send ")) { + if (msg.startsWith("send")) { String args = msg.substring(5); - - if (args.length() == 5) { - - databaseConnector.executeStatement("SELECT word FROM words WHERE word LIKE '" + args + "'"); - QueryResult result = databaseConnector.getCurrentQueryResult(); - if (result.getData().length > 0) { - - String input = result.getData()[0][0]; - String code = ""; - - code = input; - - send(code); - if (code.equals("11111")) { - send("game won"); - if (user != null) { - phase = END_PHASE; - } else { - phase = LOGIN_PHASE; - } - } else if (count == 6) { - send("game lost"); - if (user != null) { - phase = END_PHASE; - } else { - phase = LOGIN_PHASE; - } - } else { - send("game continues"); - } - - } else { - send("-ERR word not in dictionary."); - } - - } else { - send("-ERR wrong format."); - } - //vergleichen von wotd mit //ja = spiel beendet und ausgabe word 11111 //nein = ausgabe 01102 oder so und pr�fen ob man noch ein wort eingebn kann