mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 19:04:49 +00:00
IDK
This commit is contained in:
@@ -14,7 +14,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
*/
|
||||
public class EventRegistry {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(Main.class);
|
||||
private static final Logger logger = LogManager.getLogger(EventRegistry.class);
|
||||
|
||||
private static final Map<Class<?>, CopyOnWriteArrayList<EventEntry<?>>> eventHistory =
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
@@ -72,7 +72,7 @@ public class TicTacToeServer extends TcpServer {
|
||||
case MOVE -> {
|
||||
if (segments.length == 2 && !segments[1].isEmpty()) {
|
||||
this.command = commandEnum;
|
||||
this.arguments = new ArrayList<Object>();
|
||||
this.arguments = new ArrayList<Object>(1);
|
||||
this.arguments.add(segments[1]);
|
||||
this.returnMessage = TicTacToeServerMessage.OK;
|
||||
this.isValidCommand = true;
|
||||
@@ -81,17 +81,44 @@ public class TicTacToeServer extends TcpServer {
|
||||
return;
|
||||
}
|
||||
}
|
||||
case
|
||||
case FORFEIT -> {
|
||||
this.command = commandEnum;
|
||||
this.arguments = null;
|
||||
this.returnMessage = TicTacToeServerMessage.OK;
|
||||
this.isValidCommand = true;
|
||||
this.errorMessage = null;
|
||||
this.originalCommand = receivedCommand;
|
||||
return;
|
||||
}
|
||||
case MESSAGE -> {
|
||||
if (segments.length == 3 && !segments[2].isEmpty()) {
|
||||
this.command = commandEnum;
|
||||
this.arguments = new ArrayList<Object>(2);
|
||||
this.arguments.add(segments[2]);
|
||||
this.returnMessage = TicTacToeServerMessage.OK;
|
||||
this.isValidCommand = true;
|
||||
this.errorMessage = null;
|
||||
this.originalCommand = receivedCommand;
|
||||
return;
|
||||
}
|
||||
}
|
||||
case BYE, DISCONNECT, LOGOUT, QUIT, EXIT -> {
|
||||
this.command = commandEnum;
|
||||
this.arguments = null;
|
||||
this.returnMessage = TicTacToeServerMessage.OK;
|
||||
this.isValidCommand = true;
|
||||
this.errorMessage = null;
|
||||
this.originalCommand = receivedCommand;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.command = command;
|
||||
this.arguments = arguments;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private ParsedCommand parseCommand(String command) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void gameThread() {
|
||||
@@ -99,11 +126,9 @@ public class TicTacToeServer extends TcpServer {
|
||||
|
||||
while (true) {
|
||||
String command = getNewestCommand();
|
||||
command = this.parseCommand(command);
|
||||
command = this.parseCommand(command).toString();
|
||||
if (command == null) { continue; }
|
||||
|
||||
|
||||
|
||||
// TODO: Game
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.toop.Main;
|
||||
|
||||
public class MinMaxTicTacToe {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(Main.class);
|
||||
private static final Logger logger = LogManager.getLogger(MinMaxTicTacToe.class);
|
||||
|
||||
public int findBestMove(TicTacToe game) {
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.toop.Main;
|
||||
|
||||
public class TicTacToe extends GameBase {
|
||||
public int moveCount;
|
||||
private static final Logger logger = LogManager.getLogger(Main.class);
|
||||
private static final Logger logger = LogManager.getLogger(TicTacToe.class);
|
||||
|
||||
public TicTacToe(String player1, String player2) {
|
||||
super(3); // 3x3 Grid
|
||||
|
||||
Reference in New Issue
Block a user