/**
* @return all the empty positions on the border
*/
private Set<Location> findEmptyBorderPositions() {
Box bbox = tantrix.getBoundingBox();
Set<Location> empties = new HashSet<Location>();
for (int i = bbox.getMinCol(); i <= bbox.getMaxCol(); i++) {
Location loc = new ByteLocation(bbox.getMinRow(), i);
if (tantrix.get(loc) == null) {
empties.add(loc);
}
loc = new ByteLocation(bbox.getMaxRow(), i);
if (tantrix.get(loc) == null) {
empties.add(loc);
}
}
for (int i = bbox.getMinRow() + 1; i < bbox.getMaxRow(); i++) {
Location loc = new ByteLocation(i, bbox.getMinCol());
if (tantrix.get(loc) == null) {
empties.add(loc);
}
loc = new ByteLocation(i, bbox.getMaxCol());
if (tantrix.get(loc) == null) {
empties.add(loc);
}
}
int totalLocs = (bbox.getHeight() + 1) * (bbox.getWidth() + 1);
assert (totalLocs == tantrix.size() || empties.size() > 0):
"We should have found at least one empty position on the border. Num Tiles ="
+ tantrix.size() + " bbox area = " + bbox.getArea();
return empties;
}