Skip to content

Instantly share code, notes, and snippets.

@paskamari
Created May 4, 2013 20:44
Show Gist options
  • Save paskamari/5518678 to your computer and use it in GitHub Desktop.
Save paskamari/5518678 to your computer and use it in GitHub Desktop.
laby
#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