int print_init() { int i, j; int city, loc; /* put down locations in cities */ for (i=1; i<=ncities; i++){ for (j = 1; j<=nlocs; j++){ printf(" (in-city loc%i-%i city%i)\n", i,j,i); } } /* put down airplanes and trucks */ for (i=1; i<=nplanes; i++){ city = random()%ncities + 1; printf(" (at plane%i loc%i-1)\n", i, city); } for (i=1; i<=ncities; i++){ for (j=1; j<=ntrucks; j++){ loc = random()%nlocs + 1; printf(" (at truck%i-%i loc%i-%i)\n", i, j, i, loc); } } print_random(npackages); printf(" )\n"); }
int print_final() { printf(" (:goal (and\n"); print_random(ngoals); printf(" ))\n"); printf(")\n"); }
int main(int argc, char *argv[]) { char dic_filename[1024]; struct stat st; int update_interval = 300; /* milli second */ int is_print_random = 0; snprintf(dic_filename, sizeof(dic_filename), "%s%s%s", getenv("HOME"), "/", HOME_DIC_FILENAME); if(stat(dic_filename, &st) == -1) { strcpy(dic_filename, SYSTEM_DIC_PATH); } while(1) { int c; c = getopt(argc, argv, "d:t:1hvi:"); if(c == -1) break; switch(c) { case 'd': strcpy(dic_filename, optarg); break; case 't': theme_no = atoi(optarg); break; case 'i': update_interval = atoi(optarg); break; case '1': is_print_random = 1; break; case 'h': usage(argv[0]); case 'v': printf(PROGRAM " version " VERSION "\n"); exit(0); case ':': case '?': exit(1); } } if(is_print_random) { print_random(dic_filename); exit(0); } myd = myd_open(dic_filename); if(!myd) { perror(dic_filename); exit(1); } term_init(); term_timeout(update_interval); #ifdef USE_XSELECTION get_sel_init(getenv("DISPLAY")); #endif main_loop(); finish(0); return 0; }