int main(int argc, char **argv) { init_g(); increase(); init(1252); sumg(6,7); printf("%d\n", factorial(atoi(argv[1]))); }
int main(int argc, char **args){ Grammar* g = init_g(); if ( argc == 1 ){ g->show(); g->showN(50); // g->unrank(1,11); // for(int i = 1 ; i <= g->getN(6) ; i++ ){ // std::cout << yield(g->unrank(i,6)," ") << std::endl; // } gmp_randclass r (gmp_randinit_default); int mytime = time(NULL); r.seed(mytime); mpz_class ind = r.get_z_range(g->getN(40)); ind = ind + 1; std::cout<< yield(g->unrank(ind,40)," ") << std::endl << mytime << std::endl; }else if( argc > 1 && strcmp(args[1],"random") == 0 ){ gmp_randclass r (gmp_randinit_default); int mytime = time(NULL); r.seed(mytime); mpz_class ind = r.get_z_bits(256); std::cout << ind; }else{ mpz_class ind (args[1]); std::cout<< yield(g->unrank(ind,43)," ") ; } }
static void init_setup_tab( void ) { init_wg(); init_wgs(); init_wgt0(); init_wgpt0(); init_wgst0(); init_wgspt0(); init_wgf(); init_wgfs(); init_wgft0(); init_wgfpt0(); init_wgfst0(); init_wgfspt0(); init_t0(); init_f(); init_ft0(); init_g(); init_gs(); init_gt0(); init_gst0(); init_gf(); init_gfs(); init_gft0(); init_gfst0(); }
static void init_setup_tab( void ) { init_w(); init_g(); init_wg(); init_t(); init_wt(); init_gt(); init_wgt(); }
static void * kaleidescope_init (Display *dpy, Window window) { GLOBAL *g = (GLOBAL *) calloc (1, sizeof(*g)); g->dpy = dpy; g->window = window; init_g (g); create_objects(g); init_objects (g); return g; }
main() { GUSANO *g; int i,j; int dir = 1; /* 0: N, 1: E, 2: S, 3: W */ char s[200]; srandom(time(NULL)); for(i=0; i<MAXX/GORDO; i++) for(j=0; j<MAXY/GORDO; j++) tablero[i][j] = 0; init_w(MAXX, MAXY); g = init_g(MAXX/2, MAXY/2, dir, 4); /* x,y,dir,largo */ if(!galleta_id) cookie(MAXX, MAXY); for(;;) { usleep(100000); switch(getchar()) { case 'h': /* back */ dir = 3; break; case 'j': /* down */ dir = 2; break; case 'k': /* up */ dir = 0; break; case 'l': /* forward */ dir = 1; break; case EOF: goto fin; break; default: continue; break; } g->dir = dir; if( !move_g(g) ) { fin: sprintf(s, "Boing!!, score = %d", size_l(g->cuerpo)); free_g(g); close_w(s, 100, 100); exit(0); } } }
static void init_setup_tab( void ) { init_wg(); /* pos + col */ init_wgt0(); /* pos + col + tex0 */ init_wgpt0(); /* pos + col + p-tex0 (?) */ init_t0(); /* tex0 */ init_g(); /* col */ init_gt0(); /* col + tex */ init_wgf(); init_wgft0(); init_wgfpt0(); init_f(); init_gf(); init_gft0(); }
static void init_setup_tab( void ) { init_wg(); init_wgs(); init_wgt0(); init_wgt0t1(); init_wgpt0(); init_wgst0(); init_wgst0t1(); init_wgspt0(); init_wgf(); init_wgfs(); init_wgft0(); init_wgft0t1(); init_wgfpt0(); init_wgfst0(); init_wgfst0t1(); init_wgfspt0(); init_t0(); init_t0t1(); init_f(); init_ft0(); init_ft0t1(); init_g(); init_gs(); init_gt0(); init_gt0t1(); init_gst0(); init_gst0t1(); init_gf(); init_gfs(); init_gft0(); init_gft0t1(); init_gfst0(); init_gfst0t1(); /* Add proj texturing on t1 */ init_wgpt0t1(); init_wgspt0t1(); init_wgfpt0t1(); init_wgfspt0t1(); }
static void init_setup_tab( void ) { init_wg(); init_wg_fog(); init_wgt0(); init_wgt0t1(); init_wgpt0(); init_wgpt0t1(); init_g(); init_t0(); init_t0t1(); init_gt0(); init_gt0t1(); /* fogcoord */ init_wgf(); init_wgt0f(); init_wgt0t1f(); init_wgpt0f(); init_wgpt0t1f(); }
int main(int argc, char **argv) { if (argc < 6) print_usage(argv); char *path = argv[1]; int start = atoi(argv[2]), end = atoi(argv[3]), i, *bkgc; //IplImage *bkg = alignedImageFrom(mkname(path, 1), 8); IplImage *bkg = alignedImageFrom(argv[4], 8); int dim = plane_coeffs[0] + plane_coeffs[1] + plane_coeffs[2]; CvSize bsz = cvGetSize(bkg); IplImage *d8 = alignedImageFrom(argv[5], 8); //IplImage *d8 = alignedImageFrom(mkname(path, 1), 8); int w = bsz.width - 8 + 1, h = bsz.height - 8 + 1, sz = w*h; kd_tree kdt; printf("cd: %s %d %d %s %s\n", path, start, end, argv[4], argv[5]); init_g(bkg); memset(&kdt, 0, sizeof(kd_tree)); /* IplImage *b32 = cvCreateImage(bsz, IPL_DEPTH_32F, bkg->nChannels); IplImage *i32 = cvCreateImage(bsz, IPL_DEPTH_32F, bkg->nChannels); IplImage *d32 = cvCreateImage(bsz, IPL_DEPTH_32F, bkg->nChannels); IplImage *diff= cvCreateImage(bsz, IPL_DEPTH_32F, bkg->nChannels); cvXor(b32, b32, b32, NULL); cvXor(d32, d32, d32, NULL); cvConvertScale(bkg, b32, 1/255.0, 0); for (i = 1; i < start; i++) { IplImage *img = alignedImageFrom(mkname(path, i), 8); cvConvertScale(img, i32, 1/256.0, 0); cvAbsDiff(i32, b32, diff); cvRunningAvg(diff, d32, 1.0/start, NULL); cvRunningAvg(i32, b32, 1.0/start, NULL); cvReleaseImage(&img); cvShowImage("avg diff", d32); cvWaitKey(1); printf("i: %d\r", i); } cvConvertScale(b32, bkg, 255, 0); cvReleaseImage(&b32); cvReleaseImage(&i32); if (argc >= 6) { cvSaveImage(argv[4], bkg, 0); cvConvertScale(d32, d8, 255, 0); cvSaveImage(argv[5], d8, 0); // difference image return 0; } */ int *imgc = block_coeffs(d8, plane_coeffs); IplImage *rev = splat(imgc, bsz, plane_coeffs); free(imgc); cvReleaseImage(&rev); prop_coeffs(bkg, plane_coeffs, &bkgc); kdt_new(&kdt, bkgc, sz, dim); /*thread_ctx ctxs[3]; pthread_t thrs[sizeof(ctxs)/sizeof(thread_ctx)]; for (i = 0; i < (int)(sizeof(ctxs)/sizeof(thread_ctx)); i++) { thread_ctx *ctx = &ctxs[i]; ctx->start = i+1; ctx->end = end; ctx->nb = sizeof(ctxs)/sizeof(thread_ctx); ctx->path = path; ctx->outfile = argc >= 7 ? argv[6] : NULL; ctx->bkg = bkg; ctx->diff = d8; ctx->kdt = &kdt; pthread_create(&thrs[i], NULL, run_thr, ctx); } for (i = 0; i < (int)(sizeof(ctxs)/sizeof(thread_ctx)); i++) { pthread_join(thrs[i], NULL); } printf("all done!\n");*/ double t; char outname[1024]; memset(outname, '\0', sizeof(outname)); for (i = start; i <= end; i++) { IplImage *img = alignedImageFrom(mkname(path, i), 8); double start = get_time(); if (argc >= 7) snprintf(outname, sizeof(outname), "%s/bin%06d.png", argv[6], i); //process(&kdt, bkg, d8, img, outname); //test(img); cvShowImage("image", img); t += (get_time() - start); if ((cvWaitKey(1)&255)==27)break; // esc cvReleaseImage(&img); } //free_g(); kdt_free(&kdt); free(bkgc); cvReleaseImage(&bkg); cvReleaseImage(&d8); return 0; }
int main (int argc, char const *argv[]) { int i,j; int dir = 1; /* 0: N, 1: E, 2: S, 3: W */ char s[200]; /* debug("Starting Application: %s\n", argv[0]); */ if(argc != 2) { fprintf(stderr,"Use: %s program\n", argv[0]); return EXIT_FAILURE; } runWish(); close(STDIN_FILENO); if(open(argv[1],O_RDONLY,NULL)) { printf("Error al Abrir el archivo\n"); return EXIT_FAILURE; } srand(time(NULL)); for(i=0;i<MAXX/GORDO;i++) for(j=0;j<MAXY/GORDO;j++) tablero[i][j] = 0; init_w(MAXX, MAXY,"Gusano - Tarea 3"); g = init_g(MAXX/2, MAXY/2, dir, 4); /* x,y,dir,largo */ if(!galleta_id) cookie(MAXX, MAXY); for(;;) { usleep(100000); dir = eval(g); if(dir == -1) { exit(EXIT_FAILURE); } else { g->dir = dir; if( !move_g(g) ) { sprintf(s, "Boing!!, score = %d", size_l(g->cuerpo)); showColitionPoint(g); free_g(g); g=NULL; close_w(s, 100, 100); waitWish(wpid); exit(0); } } close(STDIN_FILENO); if(open(argv[1],O_RDONLY,NULL)) { printf("Error al Abrir el archivo\n"); exit(EXIT_FAILURE); } } exit(EXIT_FAILURE); }
static void init_setup_tab( void ) { init_wg(); init_wgt0(); init_wgt0t1(); init_wgpt0(); init_wgpt0t1(); init_wga(); init_wgt0a(); init_wgt0t1a(); init_wgpt0a(); init_wgpt0t1a(); init_2wg(); init_2wgt0(); init_2wgt0t1(); init_2wgpt0(); init_2wgpt0t1(); init_2wga(); init_2wgt0a(); init_2wgt0t1a(); init_2wgpt0a(); init_2wgpt0t1a(); init_wgf(); init_wgt0f(); init_wgt0t1f(); init_wgpt0f(); init_wgpt0t1f(); init_wgaf(); init_wgt0af(); init_wgt0t1af(); init_wgpt0af(); init_wgpt0t1af(); init_2wgf(); init_2wgt0f(); init_2wgt0t1f(); init_2wgpt0f(); init_2wgpt0t1f(); init_2wgaf(); init_2wgt0af(); init_2wgt0t1af(); init_2wgpt0af(); init_2wgpt0t1af(); init_wsg(); init_wsgt0(); init_wsgt0t1(); init_wsgpt0(); init_wsgpt0t1(); init_wsga(); init_wsgt0a(); init_wsgt0t1a(); init_wsgpt0a(); init_wsgpt0t1a(); init_2wsg(); init_2wsgt0(); init_2wsgt0t1(); init_2wsgpt0(); init_2wsgpt0t1(); init_2wsga(); init_2wsgt0a(); init_2wsgt0t1a(); init_2wsgpt0a(); init_2wsgpt0t1a(); init_wsgf(); init_wsgt0f(); init_wsgt0t1f(); init_wsgpt0f(); init_wsgpt0t1f(); init_wsgaf(); init_wsgt0af(); init_wsgt0t1af(); init_wsgpt0af(); init_wsgpt0t1af(); init_2wsgf(); init_2wsgt0f(); init_2wsgt0t1f(); init_2wsgpt0f(); init_2wsgpt0t1f(); init_2wsgaf(); init_2wsgt0af(); init_2wsgt0t1af(); init_2wsgpt0af(); init_2wsgpt0t1af(); init_g(); init_t0(); init_t0t1(); init_gt0(); init_gt0t1(); init_2g(); init_2t0(); init_2t0t1(); init_2gt0(); init_2gt0t1(); }