This commit is contained in:
aelga 2025-05-16 13:08:44 +02:00
parent 139ae2c07d
commit ce2f481729
4 changed files with 24 additions and 1 deletions

View File

@ -458,4 +458,5 @@ public class Board {
}
return false;
}
}

View File

@ -107,4 +107,15 @@ public class Game extends Thread {
this.activationAIFlags[isWhite?1:0] = !this.activationAIFlags[isWhite?1:0];
}
/*public static boolean isCheckmate(boolean b) {
// TODO Auto-generated method stub
return true;
}
/*public boolean isCheckmate() {
return board.isCheckmate();
}*/
}

View File

@ -123,7 +123,7 @@ public class JPanelChessBoard extends JPanel {
}
}
g.setColor(Color.gray);
g.setColor(Color.black);
for(int x=0; x<myGame.getWidth();x++) {
int graphX = Math.round(x*cellWidth);
g.drawLine(graphX, 0, graphX, this.getHeight());

View File

@ -1,5 +1,6 @@
package windowInterface;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
@ -29,6 +30,8 @@ import javax.swing.AbstractListModel;
import javax.swing.JToggleButton;
import javax.swing.JRadioButton;
import javax.swing.JCheckBox;
import backend.PieceType;
import javax.swing.JOptionPane;
public class MyInterface extends JFrame {
@ -259,6 +262,11 @@ public class MyInterface extends JFrame {
actionLabel.setText(panelDraw.isPieceAdderMode()?"Adding Piece":
(panelDraw.isPieceSelectorMode()?"Selecting Piece to Add":
"Playing"));
/*if (game != null && game.isCheckmate(true)) {
String winner = turnIsWhite ? "Black" : "White"; // since it's mate, last move won
JOptionPane.showMessageDialog(this, "Checkmate! " + winner + " wins.", "Game Over", JOptionPane.INFORMATION_MESSAGE);
}*/
this.repaint();
}
@ -266,4 +274,7 @@ public class MyInterface extends JFrame {
this.setStepBanner("Turn : X");
}
}