/* MAIN */ int main(int argc, char **argv){ if(argc < 6){ printf("ERROR: too few arguments.\n"); fflush(stdout); /* force it to go out */ exit(1); } FILE* input = fopen(argv[1], "r"); if(input == NULL){ printf("ERROR: file does not exist.\n"); fflush(stdout); /* force it to go out */ exit(1); } wolfBreedingPeriod = atoi(argv[2]); squirrelBreedingPeriod = atoi(argv[3]); wolfStarvationPeriod = atoi(argv[4]); int noOfGenerations = atoi(argv[5]); loadWorld(input); // fprintf(stdout, "Initial world configuration after loading from file:\n"); // fflush(stdout); /* force it to go out */ // printWorld2d(stdout); /* pressEntertoContinue(); */ worldLoop(noOfGenerations); printWorld(); fclose(input); return 0; }
int main (int argc, char** argv) { SDL_Window *win = NULL; if (SDL_Init(SDL_INIT_EVERYTHING) == -1) { printf("ERROR! %s\n", SDL_GetError()); return 1; } win = SDL_CreateWindow("Dione.", 100, 100, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN); if (!win) { printf("ERROR! %s\n", SDL_GetError()); return 1; } global_renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); if (!global_renderer) { printf("ERROR! %s\n", SDL_GetError()); return 1; } worldLoop(); SDL_DestroyRenderer(global_renderer); SDL_DestroyWindow(win); SDL_Quit(); return 0; }