Helvijs Kiselis
/
Micromouse
Algorithmus
Diff: main.cpp
- Revision:
- 33:836ab2089565
- Parent:
- 32:e984b7959cb0
- Child:
- 35:5a4e1a87b3da
--- a/main.cpp Wed May 23 01:34:36 2018 +0000 +++ b/main.cpp Wed May 23 12:30:39 2018 +0000 @@ -159,6 +159,8 @@ motion.scanMove(); }else if (route[r] == RIGHT) { + + int lastJunc = route[junction[j]]; // Kreuzung führt zu Sackgassen -> löschen junction[j] = 0; printf("Kreuzung %d Schritt %d geloscht\n", j, r); @@ -206,7 +208,7 @@ looping = true; - }else if (junction[j] == r-2 && route[r] == MOVE && route[junction[j]] != MOVE) { + }else if (junction[j] == r-2 && route[r] == MOVE && route[junction[j]] != MOVE && lastJunc == MOVE) { route[r] = 0; r--; @@ -257,6 +259,8 @@ }else if (route[r] == MOVE) { + int lastJunc = route[junction[j]]; + junction[j] = 0; if (debuging == 1) printf("Kreuzung %d Schritt %d geloscht\n", j, r); j -= 1; @@ -302,7 +306,7 @@ looping = true; - }else if (junction[j] == r-2 && route[r] == MOVE && route[junction[j]] != MOVE) { + }else if (junction[j] == r-2 && route[r] == MOVE && route[junction[j]] != MOVE && lastJunc == MOVE) { route[r] = 0; r--;