Created
May 4, 2013 20:44
-
-
Save paskamari/5518678 to your computer and use it in GitHub Desktop.
laby
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
#include "robot.h" | |
void Go(){ | |
while(look()==Void){ | |
forward(); | |
} | |
} | |
void Back(){ | |
left(); | |
left(); | |
} | |
void GoRock(){ | |
forward(); | |
forward(); | |
left(); | |
forward(); | |
} | |
void NotFind(){ | |
Back(); | |
forward(); | |
left(); | |
} | |
void Find(){ | |
take(); | |
NotFind(); | |
} | |
void DelWeb(){ | |
drop(); | |
take(); | |
} | |
void End(){ | |
Back(); | |
drop(); | |
Back(); | |
escape(); | |
while(20){ | |
Back(); | |
say("Akh Jan....."); | |
} | |
} | |
void GoWithRock(){ | |
Go(); | |
if(look()==Web){ | |
DelWeb(); | |
GoWithRock(); | |
}else if(look()==Wall){ | |
left(); | |
if(look()==Wall){ | |
Back(); | |
GoWithRock(); | |
}else{ | |
GoWithRock(); | |
} | |
}else if(look()==Rock){ | |
Back(); | |
if(look()==Wall){ | |
left(); | |
drop(); | |
left(); | |
}else{ | |
drop(); | |
Back(); | |
} | |
take(); | |
GoWithRock(); | |
} | |
} | |
void FindRock(){ | |
GoRock(); | |
if(look()==Rock){ | |
Find(); | |
GoWithRock(); | |
}else{ | |
NotFind(); | |
FindRock(); | |
} | |
} | |
void ant() | |
{ | |
FindRock(); | |
GoWithRock(); | |
End(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment