Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. @Override
  2.     public List<Coordinate> candidateMoves() {
  3.         List<Coordinate> candidates = new ArrayList<Coordinate>();
  4.        
  5.         for (int row = 0; row < super.board.rows(); row++)
  6.         {
  7.             if (row == super.board.row()) continue;
  8.             int col1 = super.column() - (super.row() - row);
  9.             int col2 = super.column() + (super.row() - row);
  10.             if (col1 >= 0 && col1 < super.board.cols())
  11.             {
  12.                 candidates.add(new Coordinate(row, col1));
  13.             }
  14.             if (col2 >= 0 && col2 < super.board.cols())
  15.             {
  16.                 candidates.add(new Coordinate(row, col2));
  17.             }
  18.         }
  19.  
  20.         return candidates;
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement