code: private static Iterable<Action> validMovementsFor(List<Integer> state) {
  
          int emptyTile = state.indexOf(0); // array index which corresponds to the empty tile of the board
          switch(emptyTile){
              // Ad-hoc computation of the available movements for a fixed 3x3 board.
              // NOTE: There are better ways to compute the valid actions for a general case NxN board!
              case 0: return Arrays.asList(Action.RIGHT, Action.DOWN);
              case 1: return Arrays.asList(Action.RIGHT, Action.DOWN, Action.LEFT);
              case 2: return Arrays.asList(Action.LEFT, Action.DOWN);
              case 3: return Arrays.asList(Action.UP, Action.DOWN, Action.RIGHT);
              case 4: return Arrays.asList(Action.UP, Action.DOWN, Action.RIGHT, Action.LEFT);
              case 5: return Arrays.asList(Action.UP, Action.DOWN, Action.LEFT);
              case 6: return Arrays.asList(Action.UP, Action.RIGHT);
              case 7: return Arrays.asList(Action.UP, Action.LEFT, Action.RIGHT);
              case 8: return Arrays.asList(Action.UP, Action.LEFT);
              default: throw new IllegalStateException("Invalid position");
          }
      }
docs: Computes the valid movements for a particular board (it depends
  on the position of the empty tile).
  
  Example:
  
  | 2 0 1 |  0 1 2 3 4 5 6 7 8 <- indexes of the array
  | 4 3 5 | {2,0,1,4,3,5,7,6,8}
  | 7 6 8 |
  
  Valid movements for the empty tile 0 (array index 1): LEFT, RIGHT, DOWN.
  
  @param state List of integers that represents the board state
  @return iterable with the valid actions.