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; return false;
} }
} }

View File

@ -106,5 +106,16 @@ public class Game extends Thread {
public void toggleAI(boolean isWhite) { public void toggleAI(boolean isWhite) {
this.activationAIFlags[isWhite?1:0] = !this.activationAIFlags[isWhite?1:0]; 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++) { for(int x=0; x<myGame.getWidth();x++) {
int graphX = Math.round(x*cellWidth); int graphX = Math.round(x*cellWidth);
g.drawLine(graphX, 0, graphX, this.getHeight()); g.drawLine(graphX, 0, graphX, this.getHeight());

View File

@ -1,5 +1,6 @@
package windowInterface; package windowInterface;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.GridLayout; import java.awt.GridLayout;
@ -29,6 +30,8 @@ import javax.swing.AbstractListModel;
import javax.swing.JToggleButton; import javax.swing.JToggleButton;
import javax.swing.JRadioButton; import javax.swing.JRadioButton;
import javax.swing.JCheckBox; import javax.swing.JCheckBox;
import backend.PieceType;
import javax.swing.JOptionPane;
public class MyInterface extends JFrame { public class MyInterface extends JFrame {
@ -259,11 +262,19 @@ public class MyInterface extends JFrame {
actionLabel.setText(panelDraw.isPieceAdderMode()?"Adding Piece": actionLabel.setText(panelDraw.isPieceAdderMode()?"Adding Piece":
(panelDraw.isPieceSelectorMode()?"Selecting Piece to Add": (panelDraw.isPieceSelectorMode()?"Selecting Piece to Add":
"Playing")); "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(); this.repaint();
} }
public void eraseLabels() { public void eraseLabels() {
this.setStepBanner("Turn : X"); this.setStepBanner("Turn : X");
} }
} }