correct_lonely_piece #54
@ -48,6 +48,24 @@ public class MapGenerator {
|
|||||||
map_shape[i][j] = rand.nextBoolean();
|
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);
|
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<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user