Last active
November 6, 2020 15:36
-
-
Save ArianK16a/350a241bbe03a084253cba205bccdb28 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import codescape.Dogbot; | |
public class MyDogbot extends Dogbot { | |
public void run() { | |
// move(), turnLeft() und turnRight() werden benötigt | |
// Die Energiezellen sind ohne weitere Kenntnisse noch nicht erreichbar | |
// Dein Code hier: | |
int moves = 0; | |
Boolean left = false; | |
Boolean right = false; | |
Boolean pick = false; | |
Boolean turn = false; | |
int i = 0; | |
int turn_count = 0; | |
Boolean step1 = true; | |
Boolean step2 = true; | |
Boolean step3 = true; | |
Boolean step4 = true; | |
Boolean step5 = true; | |
Boolean step6 = true; | |
Boolean step7 = true; | |
Boolean step8 = true; | |
Boolean step9 = true; | |
while (true) { | |
if (moves > 0) { | |
move(); | |
moves--; | |
continue; | |
} | |
if (left) { | |
turnLeft(); | |
left = false; | |
} | |
if (right) { | |
turnRight(); | |
right = false; | |
} | |
if (pick) { | |
pickUp(); | |
pick = false; | |
} | |
if (turn && (i == turn_count)) { | |
turn_count = i + 2; | |
} | |
if (i < turn_count) { | |
right = true; | |
i++; | |
turn = !(i == turn_count); | |
continue; | |
} | |
if (step1) { | |
left = true; | |
step1 = false; | |
continue; | |
} | |
if (step2) { | |
moves = 1; | |
pick = true; | |
turn = true; | |
step2 = false; | |
continue; | |
} | |
if (step3) { | |
moves = 2; | |
left = true; | |
step3 = false; | |
continue; | |
} | |
if (step4) { | |
moves = 2; | |
left = true; | |
step4 = false; | |
continue; | |
} | |
if (step5) { | |
moves = 2; | |
right = true; | |
step5 = false; | |
continue; | |
} | |
if (step6) { | |
moves = 2; | |
right = true; | |
step6 = false; | |
continue; | |
} | |
if (step7) { | |
moves = 2; | |
pick = true; | |
turn = true; | |
step7 = false; | |
continue; | |
} | |
if (step8) { | |
moves = 1; | |
right = true; | |
step8 = false; | |
continue; | |
} | |
if (step9) { | |
moves = 2; | |
step9 = false; | |
continue; | |
} | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment