File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/main/java/com/adventofcode/flashk/day12 Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -89,14 +89,16 @@ private int calculateRegionSides(Set<GardenPlot> gardenPlots) {
8989 //if(currentExternalAngles != 360 && currentInternalAngles != 1080) {
9090 externalAngles += currentExternalAngles ;
9191 internalAngles += currentInternalAngles ;
92+ System .out .print (gardenPlot .getPosition ().getY () + "," +gardenPlot .getPosition ().getX ());
93+ System .out .println (" - EXT: " +currentExternalAngles + " - INT: " + currentInternalAngles );
9294 //}
9395
9496
9597 internalConvexAngles += sumInternalConvexAngles (gardenPlot );
9698 }
9799
100+ //angles = externalAngles + internalAngles + internalConvexAngles;
98101 angles = externalAngles + internalAngles + internalConvexAngles ;
99-
100102 // https://www.sciencing.com/how-to-find-the-number-of-sides-of-a-polygon-12751688/
101103 return (angles / 180 ) + 2 ;
102104 }
@@ -105,19 +107,19 @@ private int sumInternalAngles(GardenPlot gardenPlot) {
105107 int angles = 0 ;
106108
107109 if (hasUpLeftInternalAngle (gardenPlot )) {
108- angles += 270 ;
110+ angles += 90 ; // 270
109111 }
110112
111113 if (hasUpRightInternalAngle (gardenPlot )) {
112- angles += 270 ;
114+ angles += 90 ;
113115 }
114116
115117 if (hasDownLeftInternalAngle (gardenPlot )) {
116- angles += 270 ;
118+ angles += 90 ;
117119 }
118120
119121 if (hasDownRightInternalAngle (gardenPlot )) {
120- angles += 270 ;
122+ angles += 90 ;
121123 }
122124
123125 return angles ;
You can’t perform that action at this time.
0 commit comments