Browse Source

4gewinnt: added gui-layout and testing methods

4gewinnt
Steffen Helmke 3 years ago
committed by Lorenz Hohmann
parent
commit
43abd90de1
  1. 36
      src/main/java/de/tims/viergewinnt/ai/Logic.java

36
src/main/java/de/tims/viergewinnt/ai/Logic.java

@ -1,6 +1,42 @@
package de.tims.viergewinnt.ai;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Logic {
//only for testing, remove when finished
static JFrame content;
static JPanel contentPanel;
static JPanel buttonPanel;
static JPanel playfieldPanel;
public static JPanel create4gewinntGui() {
//only for testing, remove when finished
content = new JFrame();
content.setSize(200,200);
contentPanel = new JPanel();
//only for testing, remove when finished
content.add(contentPanel);
buttonPanel = new JPanel();
playfieldPanel = new JPanel();
contentPanel.add(buttonPanel);
contentPanel.add(playfieldPanel);
return contentPanel;
}
//only for testing, remove when finished
public static void main(String[] args) {
create4gewinntGui();
content.setVisible(true);
}
public boolean testForWin(int[][] playfield, int player) {
int chain = 0;
for(int i = 0; i < playfield[0].length; i++) {

Loading…
Cancel
Save