correct_lonely_piece #54

Merged
Mat_02 merged 2 commits from correct_lonely_piece into master 2023-05-16 20:25:33 +02:00

View File

@ -48,6 +48,24 @@ public class MapGenerator {
map_shape[i][j] = rand.nextBoolean();
}
}
//delete lonely piece
for (int i =0;i<map_shape.length;i++){
for (int j = 0; j<map_shape[i].length;j++){
boolean test = false;
if(map_shape[i][j]){
for(int k = Math.max(i - 1, 0); k<= Math.min(i+1,map_shape.length-1); k++){
for (int l = Math.max(j - 1, 0); l<= Math.min(j+1,map_shape[i].length-1); l++){
if (k==i && l == j)
continue;
if (map_shape[k][l])
test = true;
}
}
if (!test)
map_shape[i][j] = false;
}
}
}
Map ret = new Map(map_shape);
boolean[][] piece_layout = Array.MatrixCopyOf(map_shape);
ArrayList<Vec2> EmptySlots = new ArrayList<>();