Created
May 10, 2010 13:47
-
-
Save vojto/396051 to your computer and use it in GitHub Desktop.
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 "library.c" | |
void usage(char *binary_name); | |
void turnAround(); | |
void goUntilWall(); | |
void putBeepers(int count); | |
int main(int argc, char **argv) { | |
if(argc != 2) | |
{ | |
usage(argv[0]); | |
exit(1); | |
} | |
turnOn(argv[1]); | |
int level = 1; | |
int i; | |
while(YES) { | |
turnLeft(); | |
for(i=0; i<level; i++) { | |
putBeepers(level); | |
move(); | |
} | |
turnAround(); | |
goUntilWall(); | |
turnLeft(); | |
move(); | |
if(!frontIsClear()) | |
{ | |
break; | |
} | |
level++; | |
} | |
draw(); | |
turnOff(); | |
return 0; | |
} | |
void usage(char *binary_name) { | |
printf("Usage: %s <path-to-world-file>\n", binary_name); | |
} | |
// --- | |
void turnAround() { | |
turnLeft(); | |
turnLeft(); | |
} | |
void goUntilWall() { | |
while(frontIsClear()) { | |
move(); | |
} | |
} | |
void putBeepers(int count) { | |
int i; | |
for(i=0; i<count; i++) { | |
putBeeper(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment