@@ -25,7 +25,7 @@ public static Structure flood(int x,int y, int i) {
2525 int y1 = p .y ;
2626 try {
2727
28- System .out .println ("FILL (" +x1 +"," +y1 +")" );
28+ // System.out.println("FILL ("+x1+","+y1+")");
2929 if (grid [x1 ][y1 ]) {
3030 if (x1 < N && grid [x1 + 1 ][y1 ]) {
3131 q .add (new Position (x1 + 1 ,y1 ));
@@ -39,12 +39,14 @@ public static Structure flood(int x,int y, int i) {
3939 if (1 < y1 && grid [x1 ][y1 - 1 ]) {
4040 q .add (new Position (x1 ,y1 - 1 ));
4141 }
42+ }else {
43+ continue ;
4244 }
4345 }catch (Exception ex ) {
4446 continue ;
4547 }
4648 st .addStruct (p );
47- grid [p .x ][p .y ] = false ;
49+ grid [p .x ][p .y ] = false ; // TODO remove to prevent intefering with addStruct
4850
4951 }
5052 return st ;
@@ -75,7 +77,7 @@ public static void main(String[] args) throws IOException{
7577 //st.toggleAll();
7678 //st.perimeterList.removeAll(st.posList);
7779
78- st .perimeterList .removeAll (st .posList );
80+ // st.perimeterList.removeAll(st.posList);
7981 structs .add (st );
8082 }
8183 }
@@ -86,8 +88,8 @@ public static void main(String[] args) throws IOException{
8688 //struct.toggleAll();
8789 //struct.perimeterList.removeAll(struct.posList);
8890 int area = struct .posList .size ();
89- // System.out.println("1:"+struct.posList);
90- // System.out.println("2:"+struct.perimeterList);
91+ System .out .println ("1:" +struct .posList );
92+ System .out .println ("2:" +struct .perimeterList );
9193 if (area > largestArea ) {
9294 largestArea = area ;
9395 perimOfLarge = struct .perimeterList .size ();
0 commit comments