From 90dc2e49e1401eb9845e8b2f6342f8905297a1b3 Mon Sep 17 00:00:00 2001 From: Manuel Bucher <manuel.bucher@hu-berlin.de> Date: Sun, 24 Jun 2018 13:11:54 +0200 Subject: [PATCH] added some comments --- loesung.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/loesung.c b/loesung.c index 1d9d06b..774b98c 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); -- GitLab