![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Aufgabe ClearAllBeepersToTheWall
Meine Projekte
Diese Projekte habe ich im Sommersemester 2015 in FSST programmiert:
IfBertl: Programmcode
ZurueckAnDenStart: Programmcode
AufgabeClearAllBeepersToTheWall: Programmcode
main.cpp@0:80d3f3cf7e82, 2015-04-24 (annotated)
- Committer:
- DerMax
- Date:
- Fri Apr 24 07:47:30 2015 +0000
- Revision:
- 0:80d3f3cf7e82
Aufgabe ClearAllBeepersToTheWall
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DerMax | 0:80d3f3cf7e82 | 1 | #include "ur_Bertl.h" |
DerMax | 0:80d3f3cf7e82 | 2 | #include "mbed.h" |
DerMax | 0:80d3f3cf7e82 | 3 | #include "const.h" |
DerMax | 0:80d3f3cf7e82 | 4 | |
DerMax | 0:80d3f3cf7e82 | 5 | class ClearBertl : public ur_Bertl |
DerMax | 0:80d3f3cf7e82 | 6 | { |
DerMax | 0:80d3f3cf7e82 | 7 | public: |
DerMax | 0:80d3f3cf7e82 | 8 | void ClearAllBeepersToTheWall(); |
DerMax | 0:80d3f3cf7e82 | 9 | }; |
DerMax | 0:80d3f3cf7e82 | 10 | |
DerMax | 0:80d3f3cf7e82 | 11 | void ClearBertl :: ClearAllBeepersToTheWall() |
DerMax | 0:80d3f3cf7e82 | 12 | { |
DerMax | 0:80d3f3cf7e82 | 13 | while(FrontIsClear()) |
DerMax | 0:80d3f3cf7e82 | 14 | { |
DerMax | 0:80d3f3cf7e82 | 15 | if(NextToABeeper()) |
DerMax | 0:80d3f3cf7e82 | 16 | { |
DerMax | 0:80d3f3cf7e82 | 17 | PickBeeper(); |
DerMax | 0:80d3f3cf7e82 | 18 | Move(); |
DerMax | 0:80d3f3cf7e82 | 19 | } |
DerMax | 0:80d3f3cf7e82 | 20 | else |
DerMax | 0:80d3f3cf7e82 | 21 | { |
DerMax | 0:80d3f3cf7e82 | 22 | Move(); |
DerMax | 0:80d3f3cf7e82 | 23 | } |
DerMax | 0:80d3f3cf7e82 | 24 | } |
DerMax | 0:80d3f3cf7e82 | 25 | |
DerMax | 0:80d3f3cf7e82 | 26 | } |
DerMax | 0:80d3f3cf7e82 | 27 | |
DerMax | 0:80d3f3cf7e82 | 28 | int main() |
DerMax | 0:80d3f3cf7e82 | 29 | { |
DerMax | 0:80d3f3cf7e82 | 30 | ClearBertl karel; |
DerMax | 0:80d3f3cf7e82 | 31 | |
DerMax | 0:80d3f3cf7e82 | 32 | karel.ClearAllBeepersToTheWall(); |
DerMax | 0:80d3f3cf7e82 | 33 | } |
DerMax | 0:80d3f3cf7e82 | 34 |