e
This commit is contained in:
parent
918b742029
commit
623c29e6ab
11 changed files with 19 additions and 16 deletions
|
|
@ -158,7 +158,7 @@ public class Main extends JFrame {
|
||||||
|
|
||||||
// AI Configuration
|
// AI Configuration
|
||||||
private static final String API_KEY = "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";
|
private static final String API_KEY = "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";
|
||||||
private static final String MODEL = "qwen/qwen3-4b:free";
|
private static final String MODEL = "arcee-ai/trinity-large-preview:free";
|
||||||
private char[] boardState = new char[9]; // Keep track of board state
|
private char[] boardState = new char[9]; // Keep track of board state
|
||||||
|
|
||||||
private void connectToServer() {
|
private void connectToServer() {
|
||||||
|
|
@ -248,15 +248,25 @@ public class Main extends JFrame {
|
||||||
case "WIN":
|
case "WIN":
|
||||||
String winner = msg.substring(4);
|
String winner = msg.substring(4);
|
||||||
statusLabel.setText("Winner: " + winner);
|
statusLabel.setText("Winner: " + winner);
|
||||||
// Auto RESTART if AI loses? Or wait for user? Let's just create a dialog but
|
// Auto RESTART after 3 seconds
|
||||||
// maybe auto-accept if we want seamless play? No, user requested seamless
|
new Thread(() -> {
|
||||||
// winning.
|
try {
|
||||||
// Let's just wait for user to restart.
|
Thread.sleep(3000);
|
||||||
JOptionPane.showMessageDialog(this, "Winner: " + winner);
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
send("RESTART");
|
||||||
|
}).start();
|
||||||
break;
|
break;
|
||||||
case "DRAW":
|
case "DRAW":
|
||||||
statusLabel.setText("Draw!");
|
statusLabel.setText("Draw!");
|
||||||
JOptionPane.showMessageDialog(this, "Draw!");
|
// Auto RESTART after 3 seconds
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
Thread.sleep(3000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
send("RESTART");
|
||||||
|
}).start();
|
||||||
break;
|
break;
|
||||||
case "OPPONENT_LEFT":
|
case "OPPONENT_LEFT":
|
||||||
JOptionPane.showMessageDialog(this, "Opponent left the game.");
|
JOptionPane.showMessageDialog(this, "Opponent left the game.");
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,5 +0,0 @@
|
||||||
#Generated by Maven
|
|
||||||
#Tue Feb 10 14:46:43 CET 2026
|
|
||||||
artifactId=ai-client
|
|
||||||
groupId=com.lona.tictactoe
|
|
||||||
version=1.0-SNAPSHOT
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
com/lona/tictactoe/client/Main.class
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
/home/collin/tictactoe/ai-client/src/main/java/com/lona/tictactoe/client/Main.java
|
|
||||||
Binary file not shown.
|
|
@ -60,7 +60,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="debug-log"
|
<div id="debug-log"
|
||||||
style="margin-top: 20px; font-size: 0.8rem; color: #555; text-align: left; max-height: 200px; overflow-y: auto; border: 1px solid #333; padding: 10px; display: none;">
|
style="margin-top: 20px; font-size: 0.8rem; color: #555; text-align: left; max-height: 200px; overflow-y: auto; border: 1px solid #333; padding: 10px;">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="debug-log"
|
<div id="debug-log"
|
||||||
style="margin-top: 20px; font-size: 0.8rem; color: #555; text-align: left; max-height: 200px; overflow-y: auto; border: 1px solid #333; padding: 10px; display: none;">
|
style="margin-top: 20px; font-size: 0.8rem; color: #555; text-align: left; max-height: 200px; overflow-y: auto; border: 1px solid #333; padding: 10px;">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue