diff --git a/loesung.c b/loesung.c index 822580b52327b5a624a2f7fbf3b1b0c19a33d847..4b678ab9c6e4785b0f62cdf3cddfa71048a58fc7 100644 --- a/loesung.c +++ b/loesung.c @@ -124,21 +124,21 @@ bool list_rectangle(List *this) { * Voraussetzung: notwendiges Kriterium erfuellt & es handelt sich um ein Rechteck */ void list_print_rectangle(List *this) { - for (uint32_t y = this->min.y;; y++) { - for (uint32_t x = this->min.x;; x+=2) { - if (x == this->max.x - 1) { - if ((y - this->min.y) % 2 == 0) { + for (uint32_t x = this->min.x;; x++) { + for (uint32_t y = this->min.y;; y+=2) { + if (y == this->max.y) { + if ((x - this->min.x) % 2 == 0) { // vertikaler Stein - printf("%u %u;%u %u\n", x, y, x, y+1); + printf("%u %u;%u %u\n", x, y, x+1, y); } break; } - printf("%u %u;%u %u\n", x, y, x+1, y); - if (x == this->max.x) { - break; + printf("%u %u;%u %u\n", x, y, x, y+1); + if (y == this->max.y-1) { + break; // ende des Zeile erreicht } } - if(y == this->max.y) { + if(x == this->max.x) { break; } }