diff options
-rw-r--r-- | main.cpp | 13 | ||||
-rw-r--r-- | parse.cpp | 2 | ||||
-rw-r--r-- | parse.h | 2 |
3 files changed, 12 insertions, 5 deletions
@@ -48,7 +48,7 @@ int parseInt(const char *str){ } void usage(char **argv){ - cerr<<"Usage: "<<argv[0]<<" [-r <fname>]* [-p <fname> <x> <y> <heading>]* [-s <sleeptime>]"<<endl; + cerr<<"Usage: "<<argv[0]<<" [-r <fname>]* [-p <fname> <x> <y> <heading>]* [-s <sleeptime>] [-t]"<<endl; } int main(int argc,char **argv){ @@ -61,6 +61,7 @@ int main(int argc,char **argv){ vector<RobotSpec> robotSpecs; int sleeptime=3000; + bool step = false; if(argc<=1){ usage(argv); @@ -104,6 +105,10 @@ int main(int argc,char **argv){ i+=1; break; + case 't': + step = true; + break; + default: cerr<<"Unknown switch in '"<<argv[i]<<"'"<<endl; return 1; @@ -131,11 +136,13 @@ int main(int argc,char **argv){ signal(SIGINT,signalHandler); #endif world.print(*sb); + sb->draw(); for(int i=0;i<C::autoTimeout;i++){ - usleep(sleeptime); + if(step) cin.get(); + else usleep(sleeptime); world.tick(); world.print(*sb); - sb->mvprintf(0, SIZE, "step: %5i", i); + sb->mvprintf(0, SIZE, "step: %5i", i+2); sb->draw(); } delete sb; @@ -199,4 +199,4 @@ string preprocess(istream &file){ } return result; -}
\ No newline at end of file +} @@ -8,4 +8,4 @@ using namespace std; Team assemble(const string &source); -string preprocess(istream &file);
\ No newline at end of file +string preprocess(istream &file); |