|
|
|
@ -1,81 +0,0 @@
|
|
|
|
|
package dev.kske.chess.ui;
|
|
|
|
|
|
|
|
|
|
import java.awt.Dimension;
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Project: <strong>Chess</strong><br>
|
|
|
|
|
* File: <strong>AIConfigDialog.java</strong><br>
|
|
|
|
|
* Created: <strong>16.07.2019</strong><br>
|
|
|
|
|
*
|
|
|
|
|
* @since Chess v0.1-alpha
|
|
|
|
|
* @author Kai S. K. Engelbart
|
|
|
|
|
*/
|
|
|
|
|
@Deprecated
|
|
|
|
|
@SuppressWarnings("javadoc")
|
|
|
|
|
public class AIConfigDialog extends JDialog {
|
|
|
|
|
|
|
|
|
|
private static final long serialVersionUID = -8047984368152479992L;
|
|
|
|
|
|
|
|
|
|
private int maxDepth;
|
|
|
|
|
private int alphaBetaThreshold;
|
|
|
|
|
private boolean startGame = false;
|
|
|
|
|
|
|
|
|
|
public AIConfigDialog() {
|
|
|
|
|
setSize(new Dimension(337, 212));
|
|
|
|
|
setModal(true);
|
|
|
|
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
|
|
|
|
setTitle("AI Configuration");
|
|
|
|
|
getContentPane().setLayout(null);
|
|
|
|
|
|
|
|
|
|
JSpinner spAlphaBetaThreshold = new JSpinner();
|
|
|
|
|
spAlphaBetaThreshold.setBounds(222, 68, 95, 28);
|
|
|
|
|
getContentPane().add(spAlphaBetaThreshold);
|
|
|
|
|
spAlphaBetaThreshold.setModel(new SpinnerNumberModel(-10, -100, 100, 5));
|
|
|
|
|
|
|
|
|
|
JSpinner spMaxDepth = new JSpinner();
|
|
|
|
|
spMaxDepth.setBounds(222, 6, 95, 28);
|
|
|
|
|
getContentPane().add(spMaxDepth);
|
|
|
|
|
spMaxDepth.setModel(new SpinnerNumberModel(4, 1, 10, 1));
|
|
|
|
|
|
|
|
|
|
JLabel lblAlphabetaThreshold = new JLabel("Alpha-Beta Threshold:");
|
|
|
|
|
lblAlphabetaThreshold.setBounds(16, 68, 194, 28);
|
|
|
|
|
getContentPane().add(lblAlphabetaThreshold);
|
|
|
|
|
|
|
|
|
|
JButton btnOk = new JButton("OK");
|
|
|
|
|
btnOk.setBounds(16, 137, 84, 28);
|
|
|
|
|
getContentPane().add(btnOk);
|
|
|
|
|
btnOk.addActionListener((evt) -> {
|
|
|
|
|
maxDepth = ((Integer) spMaxDepth.getValue());
|
|
|
|
|
alphaBetaThreshold = ((Integer) spAlphaBetaThreshold.getValue());
|
|
|
|
|
startGame = true;
|
|
|
|
|
dispose();
|
|
|
|
|
});
|
|
|
|
|
btnOk.setToolTipText("Start the game");
|
|
|
|
|
|
|
|
|
|
JButton btnCancel = new JButton("Cancel");
|
|
|
|
|
btnCancel.setBounds(222, 137, 95, 28);
|
|
|
|
|
getContentPane().add(btnCancel);
|
|
|
|
|
btnCancel.addActionListener((evt) -> dispose());
|
|
|
|
|
btnCancel.setToolTipText("Cancel the game start");
|
|
|
|
|
|
|
|
|
|
JLabel lblMaximalRecursionDepth = new JLabel("Maximal Recursion Depth:");
|
|
|
|
|
lblMaximalRecursionDepth.setBounds(16, 12, 194, 16);
|
|
|
|
|
getContentPane().add(lblMaximalRecursionDepth);
|
|
|
|
|
|
|
|
|
|
setLocationRelativeTo(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getMaxDepth() { return maxDepth; }
|
|
|
|
|
|
|
|
|
|
public void setMaxDepth(int maxDepth) { this.maxDepth = maxDepth; }
|
|
|
|
|
|
|
|
|
|
public int getAlphaBetaThreshold() { return alphaBetaThreshold; }
|
|
|
|
|
|
|
|
|
|
public void setAlphaBetaThreshold(int alphaBetaThreshold) { this.alphaBetaThreshold = alphaBetaThreshold; }
|
|
|
|
|
|
|
|
|
|
public boolean isStartGame() { return startGame; }
|
|
|
|
|
|
|
|
|
|
public void setStartGame(boolean startGame) { this.startGame = startGame; }
|
|
|
|
|
}
|