Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| karel:loesungen [2023/01/05 11:15] – [1.1.1 obtainArtifact] silversurfer | karel:loesungen [2023/01/05 11:39] (aktuell) – [1.2.1 climbTheStairs] silversurfer | ||
|---|---|---|---|
| Zeile 51: | Zeile 51: | ||
| } | } | ||
| </ | </ | ||
| + | ===== 1.1.3 defuseTwoBombs ===== | ||
| + | <codedoc code: | ||
| + | void defuseTwoBombs(){ | ||
| + | defuseOneBomb(); | ||
| + | turnLeft(); | ||
| + | defuseOneBomb(); | ||
| + | } | ||
| + | void defuseOneBomb() | ||
| + | { | ||
| + | goOneWay(); | ||
| + | pickBeeper(); | ||
| + | goOneWay(); | ||
| + | } | ||
| + | |||
| + | void goOneWay(){ | ||
| + | repeat(9){ | ||
| + | moveForward(); | ||
| + | } | ||
| + | turnAround(); | ||
| + | } | ||
| + | </ | ||
| + | ===== 1.1.4 practiceHomeRun ===== | ||
| + | <codedoc code: | ||
| + | void practiceHomeRun(){ | ||
| + | repeat(4){ | ||
| + | oneWay(); | ||
| + | turnLeft(); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | void oneWay(){ | ||
| + | repeat(9){ | ||
| + | moveForward(); | ||
| + | } | ||
| + | pickBeeper(); | ||
| + | | ||
| + | } | ||
| + | </ | ||
| + | ===== 1.2.1 climbTheStairs ===== | ||
| + | <codedoc code: | ||
| + | void climbTheStairs(){ | ||
| + | moveForward(); | ||
| + | repeat(6){ | ||
| + | oneStair(); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | void oneStair(){ | ||
| + | turnLeft(); | ||
| + | moveForward(); | ||
| + | turnRight(); | ||
| + | moveForward(); | ||
| + | } | ||
| + | </ | ||
| + | ===== 1.2.2 fillTheHoles ===== | ||
| + | <codedoc code: | ||
| + | void fillTheHoles(){ | ||
| + | while(frontIsClear()){ | ||
| + | if(rightIsClear()){ | ||
| + | fillOneHole(); | ||
| + | } | ||
| + | else{ | ||
| + | moveForward(); | ||
| + | } | ||
| + | } | ||
| + | | ||
| + | } | ||
| + | |||
| + | void fillOneHole(){ | ||
| + | turnRight(); | ||
| + | moveForward(); | ||
| + | dropBeeper(); | ||
| + | turnAround(); | ||
| + | moveForward(); | ||
| + | turnRight(); | ||
| + | moveForward(); | ||
| + | } | ||
| + | </ | ||