We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b88ba39 + 86498b7 commit 8dd8628Copy full SHA for 8dd8628
saxbospiral.png
-12 Bytes
saxbospiral/solve.c
@@ -94,6 +94,15 @@ static length_t
94
suggest_resize(spiral_t spiral, size_t index) {
95
// check if collides or not, return same size if no collision
96
if(spiral.collides != -1) {
97
+ /*
98
+ * if the colliding line's length is greater than 1, we cannot make any
99
+ * intelligent suggestions on the length to extend the previous line to
100
+ * (without the high likelihood of creating a line that wastes space),
101
+ * so we just return the previous line's length +1
102
+ */
103
+ if(spiral.lines[index].length > 1) {
104
+ return spiral.lines[index - 1].length + 1;
105
+ }
106
// store the 'previous' and 'rigid' lines.
107
line_t p = spiral.lines[index - 1];
108
line_t r = spiral.lines[spiral.collides];
0 commit comments