diff --git a/loesung.c b/loesung.c index 1d9d06b0ac56ef9e4d216b24dcce37cb3f80b08a..774b98c313bada4e1de681c4b325efa177c420b0 100755 --- a/loesung.c +++ b/loesung.c @@ -304,26 +304,29 @@ void hk_print(Field *this) { Tile *t = this->tiles; for (uint32_t i = 1; i < this->num_tiles; i++) { if (t[i].pair == 0) { + // Es ex. nur eine Belegung, wenn alle Knoten gemached wurden printf("None\n"); return; } } for (uint32_t i = 1; i < this->num_tiles; i++) { - if (!tile_odd(&t[i])) + if (tile_odd(&t[i])) continue; + // Gebe nur den machingpartner von der Haelfte der Knoten aus um + // Doppelungen zu vermeiden uint32_t p = t[i].pair; printf("%u %u;%u %u\n", t[i].x, t[i].y, t[p].x, t[p].y); } } void hk(Field *this) { - uint32_t result = 0; while(hk_bfs(this)) { for (uint32_t i = 1; i < this->num_tiles; i++) { if (tile_odd(&this->tiles[i])) continue; - if (this->tiles[i].pair == 0 && hk_dfs(this, i)) - result++; + // Starte Augmentation nur von Knoten, die noch nicht gemached sind + if (this->tiles[i].pair == 0) + hk_dfs(this, i); } } hk_print(this);