Created
May 4, 2013 20:01
-
-
Save dante1357/5518556 to your computer and use it in GitHub Desktop.
code marhale akhare laby! for kal kal! :D
This file contains 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
#include "robot.h" | |
int HaveRock = 0; | |
void back(){ | |
right(); | |
right(); | |
} | |
void go(){ | |
while(look()==Void){ | |
forward(); | |
} | |
} | |
void HappyEnding(){ | |
while(1){ | |
back(); | |
say("YESSSSSSSS! YESSSSSSSS! YESSSSSSSS!"); | |
} | |
} | |
void KillWeb(){ | |
drop(); | |
take(); | |
} | |
void ChangeRock(){ | |
back(); | |
if(look()==Wall){ | |
left(); | |
drop(); | |
left(); | |
take(); | |
}else{ | |
drop(); | |
back(); | |
take(); | |
} | |
} | |
void FindWay(){ | |
go(); | |
if(look()==Wall){ | |
left(); | |
if(look()==Wall){ | |
back(); | |
FindWay(); | |
} | |
FindWay(); | |
}else if(look()==Web){ | |
KillWeb(); | |
}else if(look()==Rock){ | |
ChangeRock(); | |
}else{ | |
back(); | |
drop(); | |
back(); | |
return; | |
} | |
} | |
void FindRock(){ | |
forward(); | |
left(); | |
forward(); | |
if(look()==Rock){ | |
take(); | |
back(); | |
forward(); | |
left(); | |
HaveRock = 1; | |
}else{ | |
back(); | |
forward(); | |
left(); | |
forward(); | |
FindRock(); | |
} | |
} | |
void ant(){ | |
forward(); | |
while(HaveRock == 0){ | |
FindRock(); | |
} | |
while(look()!=Exit){ | |
FindWay(); | |
} | |
escape(); | |
HappyEnding(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment