コード例 #1
0
 public static List<Cell> getSouthCells(GameBoard board) {
   Dimension d = calculateDimension(board.getCellNumber());
   int longSide = d.width;
   List<Cell> cells = new ArrayList<Cell>();
   for (int i = longSide + 1; i >= 0; i--) {
     cells.add(board.getCell(i));
   }
   return cells;
 }
コード例 #2
0
 public static List<Cell> getEastCells(GameBoard board) {
   Dimension d = calculateDimension(board.getCellNumber());
   int shortSide = d.height;
   List<Cell> cells = new ArrayList<Cell>();
   for (int i = board.getCellNumber() - shortSide; i <= board.getCellNumber() - 1; i++) {
     cells.add(board.getCell(i));
   }
   return cells;
 }
コード例 #3
0
 public static List<Cell> getWestCells(GameBoard board) {
   Dimension d = calculateDimension(board.getCellNumber());
   int longSide = d.width;
   int shortSide = d.height;
   List<Cell> cells = new ArrayList<Cell>();
   for (int i = longSide + 1 + shortSide; i > longSide + 1; i--) {
     cells.add(board.getCell(i));
   }
   return cells;
 }