Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <karel.h>
- void turnRight();
- void jumpOver();
- int main() {
- turnOn("olympics4.kw");
- setStepDelay(150);
- putBeeper();
- jumpOver();
- turnOff();
- return 0;
- }
- void turnRight(){
- turnLeft();
- turnLeft();
- turnLeft();
- }
- void jumpOver(){ if(frontIsBlocked(){
- while(frontIsBlocked()){
- turnLeft();
- while(rightIsBlocked()){
- movek();
- }
- turnRight();
- movek();
- while(rightIsBlocked()){
- movek();
- }
- turnRight();
- movek();
- while(frontIsClear()){
- movek();
- }
- while(frontIsBlocked()){
- turnLeft();
- } else { while(frontIsClear()){
- movek();
- while(frontIsBlocked() && leftIsClear()){
- turnLeft();
- while(rightIsBlocked()){
- movek();
- }
- turnRight();
- movek();
- while(rightIsBlocked()){
- movek();
- }
- turnRight();
- movek();
- while(frontIsClear()){
- movek();
- }
- while(frontIsBlocked()){
- turnLeft();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement