check draw

This commit is contained in:
2025-04-13 12:57:13 +02:00
parent 224a09c711
commit b336784a5d
15 changed files with 108 additions and 26 deletions

View File

@@ -200,9 +200,7 @@ public class Window extends JFrame implements GameListener {
@Override
public void onWin(chess.model.Color color) {
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(this, "Victory of " + color);
});
JOptionPane.showMessageDialog(this, "Victory of " + color);
}
@Override
@@ -223,16 +221,12 @@ public class Window extends JFrame implements GameListener {
@Override
public void onPatSituation() {
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(this, "Pat. It's a draw!");
});
JOptionPane.showMessageDialog(this, "Pat. It's a draw!");
}
@Override
public void onSurrender(chess.model.Color color) {
SwingUtilities.invokeLater(() -> {
JOptionPane.showMessageDialog(this, color + " has surrendered.");
});
JOptionPane.showMessageDialog(this, color + " has surrendered.");
}
@Override
@@ -299,4 +293,9 @@ public class Window extends JFrame implements GameListener {
drawInvalid(move);
}
@Override
public void onDraw() {
JOptionPane.showMessageDialog(this, "Same position was repeated three times. It's a draw!");
}
}