public class Game { private Board b; private Player p1; private Player p2; public Game() { b = new Board(); p1 = new Player('R'); p2 = new Player('B'); } public void play() { int col; boolean hasWinner = false; boolean p1Wins = false; while(b.isFull() == false) { //player 1 plays b.displayBoard(); col = p1.getCol(); while(b.isFull(col) == true) { System.out.println("The column you selected is full."); System.out.println("Enter another column."); col = p1.getCol(); } b.placeChecker(col, p1.getColor()); if(b.hasWinner(col) == true || b.isFull() == true) { hasWinner = true; p1Wins = true; break; } //player 2 plays b.displayBoard(); col = p2.getCol(); while(b.isFull(col) == true) { col = p2.getCol(); } b.placeChecker(col, p2.getColor()); if(b.hasWinner(col) == true || b.isFull() == true) { hasWinner = true; break; } } if(hasWinner == true) { System.out.println("There is a winner."); if(p1Wins == true) { System.out.println("Player 1 is the winner"); } else { System.out.println("Player 2 is the winner."); } } else { System.out.println("Game over. No winner!"); } /* *create Board *create 2 players *while (b.isFull() == false) col = p1.getCol() while(b.isFull(col) == true) col = p1.getCol() b.placeChecker(col, p1.getColor()) if(b.hasWinner() == true || b.isFull() == true) break; col = p2.getCol() while(b.isFull(col) == true) col = p2.getCol() b.placeChecker(col, p2.getColor()) if(b.hasWinner() == true || b.isFull() == true) break; */ } }