Merge pull request 'correct_lonely_piece' (#54) from correct_lonely_piece into master
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			Reviewed-on: #54 Reviewed-by: Debucquoy Anthony <d.tonitch@gmail.com>
This commit is contained in:
		@ -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<>();
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user