Task 3
Fork of Liniensensor_2 by
Mein Projekt:
Dieses Projekt habe ich im SS 2015 in FSST programmiert 3. While Task
Revision 4:d69d779e204b, committed 2015-04-24
- Comitter:
- Dominik32
- Date:
- Fri Apr 24 08:09:42 2015 +0000
- Parent:
- 3:8587d08d9f65
- Commit message:
- While Task 3
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8587d08d9f65 -r d69d779e204b main.cpp --- a/main.cpp Fri Apr 24 07:46:09 2015 +0000 +++ b/main.cpp Fri Apr 24 08:09:42 2015 +0000 @@ -10,25 +10,42 @@ int main() { - ur_Bertl karel; - int x = 0; + Alle_Befehle karel; + int x =0; + while(1) { - while(karel.NextToABeeper()) - { - karel.Move(); + + while(!karel.NextToABeeper() && karel.FrontIsClear()) + { + karel.Move(); } - karel.MoveBackwards(); + karel.TurnLeft(); - x = x++; - if ( x % 2 == 0) + while(karel.NextToABeeper() && karel.FrontIsClear()) { - karel.TurnLeft(); //Damit er nicht zurückfährt + karel.PickBeeper(); + karel.Move(); + x++; } + karel.TurnAround(); + + while(x>0) + { + karel.Move(); + x--; + } + karel.TurnLeft(); + karel.Move(); + } + + + + }