Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package siena;
- public class ConnectFour {
- public static boolean redsTurn = true;
- public static int redCheck = 0;
- public static int yellowCheck = 0;
- public static boolean yellowWon = false;
- public static boolean redWon = false;
- public static int[][] slotStat;
- public static CFBoard board;
- public static void main (String[] args) throws java.lang.Exception {
- board = new CFBoard();
- board.setUp();
- slotStat = new int[7][6];
- for (int x = 0; x < 7; x++) {
- for (int y = 0; y < 6; y++) {
- slotStat[x][y] = 0;
- }
- }
- while (!redWon && !yellowWon);
- }
- public static void takeMove(int buttonPressed) {
- switch(buttonPressed){
- case 0:
- for (int x = 0; x < 7; x++) {
- for (int y = 0; y < 6; y++) {
- slotStat[x][y] = 0;
- }
- board.doThing();
- redsTurn = true;
- }
- break;
- case 1: case 2: case 3: case 4: case 5: case 6: case 7:
- if (slotStat[buttonPressed - 1][0] != 0) {
- break;
- }
- for (int y = 0; y < 6; y++) {
- if (y == 5 || slotStat[buttonPressed - 1][y + 1] != 0) {
- if(redsTurn) {
- slotStat[buttonPressed - 1][y] = 1;
- if (redCheck > 4) checkWin(buttonPressed - 1, y);
- }
- else slotStat[buttonPressed - 1][y] = 2;
- break;
- }
- }
- redsTurn = !redsTurn;
- board.doThing();
- }
- }
- private static void checkWin(int x, int y) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement