public boolean isAllowed(List<Integer> pickup,List<Integer> dropon,Board b){
  Species pickedUpSpecies=b.getSpeciesAt(pickup.get(0),pickup.get(1));
  Species droppedOnSpecies=b.getSpeciesAt(dropon.get(0),dropon.get(1));
  boolean allowed=!pickup.equals(dropon) && !pickedUpSpecies.equals(droppedOnSpecies) && !b.isFrozenAt(pickup.get(0),pickup.get(1))&& !b.isFrozenAt(dropon.get(0),dropon.get(1));
  if (allowed) {
    Board afterSwap=new Board(b);
    afterSwap.setSpeciesAt(dropon.get(0),dropon.get(1),pickedUpSpecies);
    afterSwap.setSpeciesAt(pickup.get(0),pickup.get(1),droppedOnSpecies);
    allowed&=madeACombo(dropon,pickedUpSpecies,afterSwap) || madeACombo(pickup,droppedOnSpecies,afterSwap);
  }
  return allowed;
}

public boolean isAllowed ( List < Integer > pickup , List < Integer > dropon , Board b ) { Species pickedUpSpecies = b . getSpeciesAt ( pickup . get ( 0 ) , pickup . get ( 1 ) ) ; Species droppedOnSpecies = b . getSpeciesAt ( dropon . get ( 0 ) , dropon . get ( 1 ) ) ; boolean allowed = ! pickup . equals ( dropon ) && ! pickedUpSpecies . equals ( droppedOnSpecies ) && ! b . isFrozenAt ( pickup . get ( 0 ) , pickup . get ( 1 ) ) && ! b . isFrozenAt ( dropon . get ( 0 ) , dropon . get ( 1 ) ) ; if ( allowed ) { Board afterSwap = new Board ( b ) ; afterSwap . setSpeciesAt ( dropon . get ( 0 ) , dropon . get ( 1 ) , pickedUpSpecies ) ; afterSwap . setSpeciesAt ( pickup . get ( 0 ) , pickup . get ( 1 ) , droppedOnSpecies ) ; allowed &= madeACombo ( dropon , pickedUpSpecies , afterSwap ) || madeACombo ( pickup , droppedOnSpecies , afterSwap ) ; } return allowed ; }
checks if the given pickup and dropon move is allowed for the given board .
