@Test public void testValidMoves() { Connect4Board board = createTestBoard(); assertArrayEquals(new int[] { 0, 1, 2, 3, 4, 5, 6 }, board.getValidMoves().toArray()); }
public IntArrayList getValidMoves() { IntArrayList moves = new IntArrayList(BOARD_WIDTH); for (int i = 0; i < BOARD_WIDTH; i++) { if (isValidMove(i)) { moves.add(i); } } return moves; }
Connect4Board implements Board { public IntArrayList getValidMoves() { IntArrayList moves = new IntArrayList(BOARD_WIDTH); for (int i = 0; i < BOARD_WIDTH; i++) { if (isValidMove(i)) { moves.add(i); } } return moves; } }
Connect4Board implements Board { public IntArrayList getValidMoves() { IntArrayList moves = new IntArrayList(BOARD_WIDTH); for (int i = 0; i < BOARD_WIDTH; i++) { if (isValidMove(i)) { moves.add(i); } } return moves; } Connect4Board();  Connect4Board(int[][] board);  Connect4Board(double[] board, int rows, int cols); private  Connect4Board(int[] buffer, int[] colHeights, boolean gameOver, int winner); }
Connect4Board implements Board { public IntArrayList getValidMoves() { IntArrayList moves = new IntArrayList(BOARD_WIDTH); for (int i = 0; i < BOARD_WIDTH; i++) { if (isValidMove(i)) { moves.add(i); } } return moves; } Connect4Board();  Connect4Board(int[][] board);  Connect4Board(double[] board, int rows, int cols); private  Connect4Board(int[] buffer, int[] colHeights, boolean gameOver, int winner); @Override int getWidth(); @Override int getHeight(); @Override void setValue(int row, int col, int color); @Override void setValue(int pos, int color); @Override int getValue(int row, int col); int getValueInv(int row, int col); @Override int getValue(int pos); @Override void invert(); @Override Connect4Board createAfterState(int row, int col, int player); Connect4Board makeMove(int col, int player); int moveToPos(int col); boolean isEmpty(int row, int col); IntArrayList getValidMoves(); boolean isValidMove(int col); int[] getOccupiedCells(int playerColor); boolean isGameOver(); int getWinner(); @Override boolean equals(Object obj); @Override int hashCode(); @Override Connect4Board clone(); @Override String toString(); static double playerValue(int player); int[][] toThillBoard(); static Connect4Board fromThillBoard(int[][] thillBoard); }
Connect4Board implements Board { public IntArrayList getValidMoves() { IntArrayList moves = new IntArrayList(BOARD_WIDTH); for (int i = 0; i < BOARD_WIDTH; i++) { if (isValidMove(i)) { moves.add(i); } } return moves; } Connect4Board();  Connect4Board(int[][] board);  Connect4Board(double[] board, int rows, int cols); private  Connect4Board(int[] buffer, int[] colHeights, boolean gameOver, int winner); @Override int getWidth(); @Override int getHeight(); @Override void setValue(int row, int col, int color); @Override void setValue(int pos, int color); @Override int getValue(int row, int col); int getValueInv(int row, int col); @Override int getValue(int pos); @Override void invert(); @Override Connect4Board createAfterState(int row, int col, int player); Connect4Board makeMove(int col, int player); int moveToPos(int col); boolean isEmpty(int row, int col); IntArrayList getValidMoves(); boolean isValidMove(int col); int[] getOccupiedCells(int playerColor); boolean isGameOver(); int getWinner(); @Override boolean equals(Object obj); @Override int hashCode(); @Override Connect4Board clone(); @Override String toString(); static double playerValue(int player); int[][] toThillBoard(); static Connect4Board fromThillBoard(int[][] thillBoard); static final int BOARD_HEIGHT; static final int BOARD_WIDTH; static final RectSize SIZE; static final RectSize BOARD_SIZE; static final int NUM_VALUES; static final int BUFFER_SIZE; }