Hello, my program is about connectFour game. I need help with resolving the logic for this problem. I appreciate your help very much.
**Client:** package FourPack; import javax.swing.*; /* Algorithm Level 0: Continue until the user wishes to quit Prompt the user to select whether they will be playing with another player or against the computer Prompt the user to select whether they will be player 1(yellow) or player 2(red) Player 1 selects which column they will be placing their token in Place the token at the top of the chosen column Repeat the same process for player 2 If either player attempts to place the token in a full column, output an error message Inform each player of how many tokens each has remaining If either player gets four of their tokens in consecutive diagonal, horizontal, or vertical order before the other, they win */ public class ConnectFourClient extends GBFrame { private JButton quit, player1, player2, newGame, col1, col2, col3, col4, col5, col6, col7; private JTextArea board; private JLabel title; private int playerNum; ConnectFourServer game = new ConnectFourServer(); private ConnectFourClient() { title = addLabel("Connect Four", 1,4,1,1); player1 = addButton("Player 1: Yellow", 2,6,1,1); player2 = addButton("Player 2: Red", 2,7,1,1); col1 = addButton("Add Token", 3,1,1,1); col2 = addButton("Add Token", 3,2,1,1); col3 = addButton("Add Token", 3,3,1,1); col4 = addButton("Add Token", 3,4,1,1); col5 = addButton("Add Token", 3,5,1,1); col6 = addButton("Add Token", 3,6,1,1); col7 = addButton("Add Token", 3,7,1,1); quit = addButton("Quit", 12,7,1,1); board = addTextArea("", 4,1,7,6); playerNum = 0; } public void buttonClicked(JButton b) { if(b==player1) { playerNum = game.selectPlayer(1); messageBox("You are player " + playerNum + "."); } else if(b==player2) { playerNum = game.selectPlayer(2); messageBox("You are player " + playerNum + "."); } else if(b==col1) { if(playerNum==1) { game.play(0,'y'); board.setText(game.getBoard()); if(game.turn()==2) { messageBox("It is player2's turn."); } } else if(playerNum==2) { game.play(0,'r'); board.setText(game.getBoard()); } } else if(b==col2) { if(playerNum==1) { game.play(1,'y'); board.setText(game.getBoard()); } else if(playerNum==2) { game.play(1,'r'); board.setText(game.getBoard()); } } else if(b==col3) { if(playerNum==1) { game.play(2,'y'); board.setText(game.getBoard()); } else if(playerNum==2) { game.play(2,'r'); board.setText(game.getBoard()); } } else if(b==col4) { if(playerNum==1) { game.play(3,'y'); board.setText(game.getBoard()); } else if(playerNum==2) { game.play(3,'r'); board.setText(game.getBoard()); } } else if(b==col5) { if(playerNum==1) { game.play(4,'y'); board.setText(game.getBoard()); } else if(playerNum==2) { game.play(4,'r'); board.setText(game.getBoard()); } } else if(b==col6) { if(playerNum==1) { game.play(5,'y'); board.setText(game.getBoard()); } else if(playerNum==2) { game.play(5,'r'); board.setText(game.getBoard()); } } else if(b==col7) { if(playerNum==1) { game.play(6,'y'); board.setText(game.getBoard()); } else if(playerNum==2) { game.play(6,'r'); board.setText(game.getBoard()); } } else if(b==quit) { System.exit(0); } } public static void main(String[] args) { ConnectFourClient theGUI = new ConnectFourClient(); theGUI.setSize(800, 600); theGUI.setVisible(true); theGUI.setTitle("Connect Four"); } } **Server:** package FourPack; import BreezySwing.*; public class ConnectFourServer { char[][] gameBoard = new char[6][7]; int yellowLeft, redLeft, player, turn, num, full; boolean filled; /* The game board is a grid of 6 rows and 7 columns. * The character 'y' represents the placement of player one's token(yellow) * The character 'r' represents the placement of player two's token(red) * If a position in the array is set to null, it is indicated that a token has * not been placed in that spot yet. * Rows are numbered 1-6, and columns are 1-7. The index of a position in the array is its column# -1 and row# -1.*/ public ConnectFourServer() { yellowLeft = 21; redLeft = 21; turn = 0; num = 2; full = 0; filled = false; } public int selectPlayer(int c) { if(c==1) { player = 1; } else if(c==2) { player = 2; } return player; } public char[][] play(int p, char color) { for(int i = 5; i>=0; i-- ) { if(gameBoard[i][p]=='\u0000') { gameBoard[i][p] = color; break; } } full++; return gameBoard; } public String getBoard() { String sb = ""; for(int i = gameBoard.length-1; i>=0; i--) { for(int j = 0; j < gameBoard[i].length-1; j++) { sb = sb + Format.justify('c', gameBoard[i][j], 15) + "|"; } sb += "\n-\n"; } return sb; } public String checkBoard() { String check = ""; if(filled==true) { check = "rf"; } if(full==42) { check = check + "bf"; } return check; } public boolean getWin(int c) { boolean win = false; for(int i = 5; i>=2; i--) { } return win; } public int turn() { if(num%2!=0) { turn = 1; } else turn = 2; num++; return turn; } }