Make the code to sub a piece alone without link to others pieces
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Mat 2023-05-15 19:31:21 +02:00
parent 3dd1b6b059
commit 16d2c89e95

View File

@ -48,6 +48,24 @@ public class MapGenerator {
map_shape[i][j] = rand.nextBoolean(); map_shape[i][j] = rand.nextBoolean();
} }
} }
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); Map ret = new Map(map_shape);
boolean[][] piece_layout = Array.MatrixCopyOf(map_shape); boolean[][] piece_layout = Array.MatrixCopyOf(map_shape);
ArrayList<Vec2> EmptySlots = new ArrayList<>(); ArrayList<Vec2> EmptySlots = new ArrayList<>();