/* * Binding event. */ extern void solver_event_bind(var_t x, var_t y) { conslist_t cs = solver_var_search(x); while (cs != NULL) { cons_t c = cs->cons; cs = cs->next; if (ispurged(c)) continue; if (decision(c->b) == UNKNOWN) continue; solver_event(c, EVENT_BIND); } cs = solver_var_search(y); while (cs != NULL) { cons_t c = cs->cons; cs = cs->next; if (ispurged(c)) continue; if (decision(c->b) == UNKNOWN) continue; solver_event(c, EVENT_BIND); } }
int main(){ int card, my1bet, op1bet, bet1, my2bet, op2bet, decision1, decision2, opCard; int trash; while(true){ scanf("%d", &card); fprintf(stderr, "CARD %d\n", card); my1bet = firstBet(card); printf("%d\n",my1bet); fflush(stdout); scanf("%d",&op1bet); fprintf(stderr,"op1bet %d\n", op1bet); if(op1bet > my1bet){ decision1 = decision(my1bet, op1bet, card); fprintf(stderr, "making decision %d\n", decision1); if(decision1 == 0){ printf("%d\n", decision1); fflush(stdout); continue; } } if(my1bet > op1bet){ scanf("%d", &decision1); fprintf(stderr, "op made decision %d\n", decision1); if(decision1 == 0){ continue; } } if(my1bet == op1bet){ fprintf(stderr,"equal 1bet\n"); } //SECOND BET fprintf(stderr, "second round\n"); my2bet = secondBet(my1bet, op1bet, card); printf("%d\n", my2bet); fflush(stdout); scanf("%d", &op2bet); fprintf(stderr, "op2bet %d\n", op2bet); if(op2bet > my2bet){ decision2 = decision(my1bet+my2bet, op1bet+op2bet, card); fprintf(stderr, "making decision %d\n", decision2); printf("%d\n", decision2); fflush(stdout); if(decision2 == 0) continue; } if(my2bet > op2bet){ scanf("%d", &decision2); fprintf(stderr, "op made decision %d\n", decision2); if(decision2 == 0) continue; } if(my2bet == op2bet){ fprintf(stderr, "equal 2bet\n"); } scanf("%d", &opCard); } return 0; }
void wasmint::TestCaseGenerator::generateModule() { source_ << "module "; if (decision(50)) generateMemory(); while (decision(90)) generateFunction(); if (decision(99)) generateMainFunction(); if (decision(3)) mutateSource(); }
void Option(int& scene, Font& font) { Texture bg = Texture("res/image/bg_ope.png"); //決定音 Media decision("res/sound/decision.wav"); while (scene == OPTION || decision.isPlaying()) { if (!env.isOpen()){ exit(0); } if (env.isPushKey(GLFW_KEY_ENTER)) { scene = TITLE; decision.play(); } env.begin(); //背景 drawTextureBox(-WIDTH / 2, -HEIGHT / 2, WIDTH, HEIGHT, 0, 0, 512, 285, bg); font.draw("もどる", Vec2f(800.0f, -400.0f) - font.drawSize("もどる") / 2, Color::olive); env.end(); } env.flushInput(); }
float *Beststump (example* arr,int d,int n) { float *ar = malloc(sizeof(int)*5); ar[2]=2; ar[3]=0; for (int i=0; i<d; i++) { quickSort(arr,0,320,i); printf("%d\n",i); float *ar2 = decision(arr,i,n); if(((ar2[2]<ar[2]))||(((ar2[3]>ar[3])&&(ar2[2]==ar[2])))) { ar[0]=ar2[0]; ar[1]=ar2[1]; ar[2]=ar2[2]; ar[3]=ar2[3]; ar[4]=i; } } return ar; }
int main() { int a[20],left=0,right,i,n,price; printf("\n enter the price of the machine "); /*Price of machine to be purchased machine */ scanf("%d",&price); printf("enter the total number of coins \n"); /*total number of coins */ scanf("%d",&n); right=n-1; for (i = 0; i < n; i += 1) /*Taliking value opf individual coin*/ { scanf("%d",&a[i]); } /* printf("\n unsorted array ");*/ /*priniting of unsorted chillar */ /* for (i = 0; i < n; i += 1)*/ /* {*/ /* printf("%d ",a[i]);*/ /* }*/ quicksort(a,left,right); /* printf("\n after sorting chillar ");*/ /*printing of chillar after sorting */ /* for (i = 0; i < n; i += 1)*/ /* {*/ /* printf("%d ",a[i]);*/ /* }*/ decision(a,n-1,price); return 0; }
/* * Decision event. */ extern void solver_event_decision(cons_t c) { if (ispurged(c)) return; event_t e = (decision(c->b) == TRUE? EVENT_TRUE: EVENT_FALSE); solver_event(c, e); }
void Game::on_trueBtn_clicked() { decision(true); if(!stopwatch->isActive()){ stopwatch->start(); elapsed->start(); } }
DAction* Sarsa::learn(const DState& s, double r, float lrate, float epsilon, float discount) { //Choose a from s using policy derived from Q DAction* a = decision(s, epsilon); Q(ds,da) = Q(ds,da) + lrate*(r+discount*Q(s, *a) - Q(ds, da) ); delete ds; delete da; ds = new DState(s); da = a; return a; }
int main(int argc, const char * argv[]) { // insert code here... printf("please enter your code\n"); scanf("%s",code); encryption(); printf("your code after encrypted:%s\n",code); printf("do you want to encry your code? y/n \n"); if(decision()==1) { decryption(); printf("your code after decryption:%s\n",code); }else{ printf("欢迎再次使用本加密系统\n"); } return 0; }
int decision_map(int depth, int* board, int heuristic_number) { return decision(depth, BOARD_ARGS_ELEMENTS, 0.2, 0.9, 2.3, 1.0, 1.9, heuristic_number); }
int main(int argc,char ** argv){ int key; int w,h; IplImage* img,*img1; CvCapture* capture = NULL; CvCapture* cap2=NULL; CvRect pr; CvRect * r; w=150; h=100; int start=100; if(NULL==(capture = cvCaptureFromCAM(0))){ printf("\nError on cvCaptureFromCAM"); return -1; } /*if(NULL==(cap2 = cvCaptureFromAVI("../TestingSData/infile.ogv"))){ printf("\nError on cvCaptureFromCAM"); return -1; }*/ cvNamedWindow("Capture", CV_WINDOW_AUTOSIZE); cvNamedWindow("Captured",CV_WINDOW_AUTOSIZE); cvMoveWindow("Capture", 550, 250); cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH,640); cvSetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT,480); for(;;){ if(NULL==(img=cvQueryFrame(capture))){ printf("\nError on cvQueryFrame"); break; } pr=cvRect(start,start,start+w,start+h); r=≺ img1=cvCreateImage(cvSize(r->width,r->height),img->depth,img->nChannels); cvSetImageROI(img,*r); cvCopy(img,img1,NULL); cvResetImageROI(img); cvRectangle( img, cvPoint(r->x,r->y), cvPoint(r->x+r->width,r->y+r->height), colors[0] ); cvShowImage("Capture",img); cvShowImage("Captured",img1); key = cvWaitKey(100); if((key&0x7f)==27) break; } fprintf(stderr,"successful exit\n"); IplImage* skin=cvCreateImage( cvGetSize(img1), img1->depth,3); cvCvtColor(img1,skin,CV_BGR2HSV); for(;;){ if(NULL==(img=cvQueryFrame(capture))){ printf("\nError on cvQueryFrame"); break; } pr=cvRect(start,start,start+w,start+h); r=≺ img1=cvCreateImage(cvSize(r->width,r->height),img->depth,img->nChannels); cvSetImageROI(img,*r); cvCopy(img,img1,NULL); cvResetImageROI(img); cvRectangle( img, cvPoint(r->x,r->y), cvPoint(r->x+r->width,r->y+r->height), colors[0] ); cvShowImage("Capture",img); cvShowImage("Captured",img1); key = cvWaitKey(100); if((key&0x7f)==27) break; } fprintf(stderr,"successful exit\n"); IplImage* background=cvCreateImage( cvGetSize(img1), img1->depth,3); cvCvtColor(img1,background,CV_BGR2HSV); IplImage* h_plane = cvCreateImage( cvGetSize(img1), 8, 1 ); IplImage* s_plane = cvCreateImage( cvGetSize(img1), 8, 1 ); IplImage* s2_plane = cvCreateImage( cvGetSize(background), 8, 1 ); IplImage* h2_plane = cvCreateImage( cvGetSize(background), 8, 1 ); IplImage* v_plane = cvCreateImage( cvGetSize(img1), 8, 1 ); //IplImage* planes[] = { h_plane, s_plane }; //IplImage* planes2[] = { h2_plane, s2_plane }; cvCvtPixToPlane( skin, h_plane, s_plane, v_plane, 0 ); cvCvtPixToPlane( background, h2_plane, s2_plane, v_plane, 0 ); CvHistogram *hist_skins,*hist_skinh, *hist_backs,*hist_backh; int h_bins = 181, s_bins = 256; { int hist_size[] = { h_bins, s_bins }; float h_ranges[] = { 0, 180 }; // hue is [0,180] float s_ranges[] = { 0, 255 }; float* ranges[] = { h_ranges, s_ranges }; hist_skinh = cvCreateHist( 1, &hist_size[0], CV_HIST_ARRAY, &ranges[0], 1 ); hist_skins = cvCreateHist( 1, &hist_size[1], CV_HIST_ARRAY, &ranges[1], 1 ); hist_backh = cvCreateHist( 1, &hist_size[0], CV_HIST_ARRAY, &ranges[0], 1 ); hist_backs = cvCreateHist( 1, &hist_size[1], CV_HIST_ARRAY, &ranges[1], 1 ); } cvCalcHist( &h_plane, hist_skinh, 0, 0 ); cvCalcHist( &s_plane, hist_skins, 0, 0 ); cvCalcHist( &h2_plane, hist_backh, 0, 0 ); cvCalcHist( &s2_plane, hist_backs, 0, 0 ); float min[4],max[4]; int min_indx[4],max_indx[4]; /*//cvNormalizeHist( hist_skinh, 1.0 ); cvGetMinMaxHistValue( hist_skinh, &min[0], &max[0], &min_indx[0], &max_indx[0] ); //cvNormalizeHist( hist_skins, 1.0 ); cvGetMinMaxHistValue( hist_skins, &min[1], &max[1], &min_indx[1], &max_indx[1] ); //cvNormalizeHist( hist_backh, 1.0 ); cvGetMinMaxHistValue( hist_backh, &min[2], &max[2], &min_indx[2], &max_indx[2] ); //cvNormalizeHist( hist_backs, 1.0 ); cvGetMinMaxHistValue( hist_backs, &min[3], &max[3], &min_indx[3], &max_indx[3] ); */ int hskin[2]; int hback[2]; int sskin[2]; int sback[2]; range_finder(hskin,0, 180,hist_skinh,w*h,0.0001); range_finder(sskin,0, 255,hist_skins,w*h,0.01); range_finder(hback,0, 180,hist_backh,w*h,0.01); range_finder(sback,0, 255,hist_backs,w*h,0.01); fprintf(stderr,"hskin min=%d max=%d\n",hskin[0],hskin[1]); fprintf(stderr,"sskin min=%d max=%d\n",sskin[0],sskin[1]); fprintf(stderr,"hback min=%d max=%d\n",hback[0],hback[1]); fprintf(stderr,"sback min=%d max=%d\n",sback[0],sback[1]); int hrange[2],srange[2]; decision(hrange,hskin[0], hskin[1],hback[0],hback[1]); decision(srange,sskin[0], sskin[1],sback[0],sback[1]); //decide on thresholds fprintf(stderr,"hmin=%d hmax=%d\n",hrange[0],hrange[1]); fprintf(stderr,"smin=%d smax=%d\n",srange[0],srange[1]); for(;;){ if(NULL==(img=cvQueryFrame(capture))){ printf("\nError on cvQueryFrame"); break; } // h-0 179 s-61 227 cvReleaseImage(&img1); img1=binary_threshold_hsl(img,0,179,srange[0],srange[1]); cvShowImage("Capture",img); cvShowImage("Captured",img1); key = cvWaitKey(50); if((key&0x7f)==27) break; } cvReleaseImage(&img1); char * filename = "../TestingSData/11-1.png"; img = cvLoadImage( filename ); img1=binary_threshold_hsl(img,0,179,61,227); IplImage* img2=cvCreateImage(cvSize(img1->width,img1->height),img1->depth,img1->nChannels); IplConvKernel * myKernel= cvCreateStructuringElementEx(8,8,0,0,CV_SHAPE_RECT,NULL); //set the top corner to 0; cvDilate(img1,img2,myKernel,1); cvShowImage("Capture",img); cvShowImage("Captured",img1); cvNamedWindow("dilated",CV_WINDOW_AUTOSIZE); cvShowImage("dilated",img2); key = cvWaitKey(0); cvReleaseCapture(&capture); cvDestroyWindow("Capture"); cvReleaseImage( &img ); exit(1); return 0; }
bool spep::ipc::SessionGroupCacheDispatcher::dispatch( spep::ipc::MessageHeader &header, spep::ipc::Engine &en ) { std::string dispatch = header.getDispatch(); if ( dispatch.compare( 0, strlen(SESSIONGROUPCACHE), _prefix ) != 0 ) return false; if ( dispatch.compare( updateCache ) == 0 ) { // Destination method is: //virtual void updateCache( std::string &sessionID, UnicodeString groupTarget, std::vector<UnicodeString> &authzTargets, Decision decision ); SessionGroupCache_UpdateCacheCommand command; en.getObject( command ); _sessionGroupCache->updateCache( command.sessionID, command.groupTarget, command.authzTargets, command.decision ); if ( header.getType() == SPEPIPC_REQUEST ) { throw InvocationTargetException( "No return type from this method" ); } return true; } if ( dispatch.compare( clearCache ) == 0 ) { // Destination method is: //virtual void clearCache( std::map< UnicodeString, std::vector<UnicodeString> > &groupTargets ); std::map< UnicodeString, std::vector<UnicodeString> > groupTargets; en.getObject( groupTargets ); // Try to clear the cache _sessionGroupCache->clearCache( groupTargets ); if ( header.getType() == SPEPIPC_REQUEST ) { throw InvocationTargetException( "No return type from this method" ); } return true; } if ( dispatch.compare( makeCachedAuthzDecision ) == 0 ) { // Destination method is: //virtual Decision makeCachedAuthzDecision( std::string &sessionID, UnicodeString resource ); SessionGroupCache_MakeCachedAuthzDecisionCommand command; en.getObject( command ); // Try to get the authz decision Decision decision( _sessionGroupCache->makeCachedAuthzDecision( command.sessionID, command.resource ) ); if ( header.getType() == SPEPIPC_REQUEST ) { en.sendResponseHeader(); en.sendObject( decision ); } return true; } return false; }
void Game::on_falseBtn_clicked() { decision(false); }
int main() { // init signalhandler // initialize sigaction struct memset (&act, '\0', sizeof(act)); // define function to be called act.sa_handler = sighandler; act.sa_flags = 0; err = sigemptyset(&act.sa_mask); if (err < 0) { perror("sigemptyset"); } err = sigaction(SIGALRM, &act, NULL); if (err < 0) { perror ("sigaction"); return 1; } err = sigaction(SIGTERM, &act, NULL); if (err < 0) { perror ("sigaction"); return 1; } err = sigaction(SIGINT, &act, NULL); if (err < 0) { perror ("sigaction"); return 1; } // offer the user to unload modules which block LEFT // this program needs to be executed with sudo permissions anyways err = printf("Unload w1_therm, w1_gpio and wire so you can use \ LEFT_GO and LEFT_DIR?\nit is highly recommended\n\ decision (y/n): "); fflush(stdout); if ('y' == getchar()) { err = system("sudo rmmod w1_therm"); printf("w1_therm unloaded\n"); err = system("sudo rmmod w1_gpio"); printf("w1_gpio unloaded\n"); err = system("sudo rmmod wire"); printf("wire unloaded\n"); // fix a strange bug (void) getchar(); } // init stepper lib err = init_steplib(PHASE_A1, PHASE_A2, PHASE_B1, PHASE_B2, 98); if (0 != err) error_macro("steplib"); // begin the stepping while (1) { printf("step? (n or CTRL-C = exit): "); fflush(stdout); if ('n' != getchar()) { printf("fullstep, forwards, 200 * 1.8° = 360°\n"); fullstep(650000000, 200, FORWARDS); printf("fullstep, backwards, 200 * 1.8° = 360°\n"); fullstep(650000000, 200, BACKWARDS); printf("halfstep, forwards, 200 * 1.8° = 360°\n"); halfstep(650000000, 200, FORWARDS); printf("halfstep, backwards, 200 * 1.8° = 360°\n"); halfstep(650000000, 200, BACKWARDS); } } // reset the pins to 0 (LOW) again exit_steplib(); exit(EXIT_SUCCESS); }
void start_game(int nbjoueur,joueur jou[],int tourde) { int i,tour,j,k,testInt,flag[10],nbfixe,place_de_des,lance,x,*combinaison,finale,gameover; char arrete,testChar; srand((unsigned)time(NULL)); while(gameover!=1) //pour voir si le jeu est fini { for (x=tourde; x<=nbjoueur; x++) //voir c'est le tour de qui à jouer(premier si c'est une nouvelle partie, mais sa peut être une autre personne qui débute, si c'est un jeu que l'on a chargé) { printf("Tour numero %d de %s\n",jou[x-1].tour,jou[x-1].nom); for (j= 0; j<5; j++) //initialisation des flag de dé { flag[j]=0; } affiche_table(&jou[x-1]); //affiche la table de resultat for (lance=1; lance<=3; lance++) //lancement 3 fois { combinaison=lancer(flag); //on met dans combinaison l'address du tableau qui est retourner de la fonction lancer if (lance==3) //si on a fait 3 lancer,on fixe tout les dés qui reste { for (i=0; i<nbfixe; i++) { flag[i]=1; } break; } else //si c'est moins que 3 lancer { for(k=0; k>=0; k++) { printf("Combien de dés voulez-vous fixer ? (Entre 0 et 5) : "); testInt=scanf("%d",&nbfixe); if (testInt!=1 || nbfixe<0 || nbfixe>5 ) //verification des données { printf("Erreur, Le nombre doit être compris entre 0 et 5!\nRéessayer\n"); while ((testChar = getchar())!= '\n'); } else if(nbfixe>=0 && nbfixe<=5) //si on a obtenue un bon nombre on sort de la boucle { break; } } if (nbfixe == 5 || (flag[0]==1 && flag[1]==1 && flag[2]==1 && flag[3]==1 && flag[4]==1)) //si tout les des sont fixe,c'est pas utile de faire un autre lancer { for (i=0; i<nbfixe; i++) { flag[i]=1; } break; } else if (nbfixe == 0) //si il n'y a pas de des fixe,on continue de lancer { continue; } else { printf("Choisi les %d dés que tu veux fixer :\n",nbfixe); for (i=0; i<nbfixe; i++) { for (k=0; k>=0; k++) { printf("Des %d: ",i+1); testInt=scanf("%d",&place_de_des); if (testInt!=1 || place_de_des<1 || place_de_des>5 ) //verification du nombre { printf("Erreur ! Le nombre doit etre compris entre 1 et 5 !\nRéessayer!!\n"); while ((testChar = getchar())!= '\n'); //pour ne pas prendre des caracteres inutile } else if(place_de_des >= 1 && place_de_des<=5) { break; } } if (flag[place_de_des-1]==1) //si le des sont deja fixe,sa ne va pas changer { printf("Des numero %d est deja fixe\n",place_de_des); } else flag[place_de_des-1]=1; //si ce n'est pas fixé,on le fixe } if ((flag[0]==1 && flag[1]==1 && flag[2]==1 && flag[3]==1 && flag[4]==1)) //on verifie si tout les des sont fixé,on va a la fonction decision { break; } } } } printf("\n"); system("clear"); printf("Combinaison final : \n"); //affiche le resultat final for (finale=0; finale<5; finale++) { printf("%d\t",combinaison[finale]); } printf("\n"); decision(combinaison,&jou[x-1]); //aller a la fonction de decision printf("TOTAL = %d\n",jou[x-1].total); //affiche le total de joueurs gameover=gameovercheck(jou,nbjoueur); //voir si le jeu est terminer arrete=pause();//demande si il veut arreter if (arrete=='p' || arrete=='P') { call_menu_jeu(jou,nbjoueur); //appelle le menu } else { continue; //aller au tour suivant } } } affiche_score(nbjoueur,jou); //apres que le jeu est fini,on affiche qui a gagner,et on etudie si on va placer les score dans le fichier de 10 meilleurs scores call_menu(); //on appelle le menu }
void triRendering(double v0[],double v1[],double v2[],float c0[],float c1[],float c2[],double d[],double s[],int shading,double mInverse[][4]) { /*triangle constant*/ int xmax,xmin,ymax,ymin; double l0_12,l1_02,l2_01; double x_incr_alpha,x_incr_beta,x_incr_gamma; double y_incr_alpha,y_incr_beta,y_incr_gamma; double alpha0,beta0,gamma0,flag_12,flag_02,flag_01; xmin=min(min(v0[0],v1[0]),v2[0]); xmax=max(max(v0[0],v1[0]),v2[0]); ymin=min(min(v0[1],v1[1]),v2[1]); ymax=max(max(v0[1],v1[1]),v2[1]); /*const*/ l0_12 = decision(v1,v2,v0[0],v0[1]); l1_02 = decision(v0,v2,v1[0],v1[1]); l2_01 = decision(v0,v1,v2[0],v2[1]); x_incr_alpha = (v1[1]-v2[1])/l0_12; x_incr_beta = (v0[1]-v2[1])/l1_02; x_incr_gamma = (v0[1]-v1[1])/l2_01; y_incr_alpha = (v2[0]-v1[0])/l0_12; y_incr_beta = (v2[0]-v0[0])/l1_02; y_incr_gamma = (v1[0]-v0[0])/l2_01; alpha0 = decision(v1,v2,xmin,ymin)/l0_12; beta0 = decision(v0,v2,xmin,ymin)/l1_02; gamma0 = decision(v0,v1,xmin,ymin)/l2_01; /* (-1,-1) or (-2,-1) */ flag_12 = decision(v1,v2,-1,-1); flag_02 = decision(v0,v2,-1,-1); flag_01 = decision(v0,v1,-1,-1); if(flag_12 == 0) flag_12 = decision(v1,v2,-2,-1); if(flag_02 == 0) flag_02 = decision(v0,v2,-2,-1); if(flag_01 == 0) flag_01 = decision(v0,v1,-2,-1); int i,x,y; double alpha,beta,gamma; for (y = ymin; y <= ymax; y++){ alpha = alpha0; beta = beta0; gamma = gamma0; for (x = xmin; x <= xmax; x++){ if(alpha >= 0 && beta >= 0 && gamma >= 0){ if( (alpha > 0 || l0_12 * flag_12 >0) && (beta > 0 || l1_02 * flag_02 >0) && (gamma > 0 || l2_01 * flag_01 > 0)){ double z = alpha * v0[2] + beta * v1[2] + gamma * v2[2]; if(z < buffer[y*thescene.screen_w+x].z){ if(shading == 0){ for(i = 0; i < 3; i++){ buffer[y*thescene.screen_w+x].rgba[i] = illuColor[i]; } buffer[y*thescene.screen_w+x].z = z; } else if(shading == 1){ for(i = 0; i < 3; i++){ buffer[y*thescene.screen_w+x].rgba[i] = alpha * c0[i] + beta * c1[i] + gamma * c2[i]; } buffer[y*thescene.screen_w+x].z = z; } else{ double normal[3]; for(i = 0; i < 3; i++){ normal[i] = alpha * c0[i] + beta * c1[i] + gamma * c2[i]; } vecUnitization(normal,normal); double w = alpha * v0[3] + beta * v1[3] + gamma * v2[3]; double p[4] = {x*w,y*w,z,w}; matrixApply(mInverse,p); Illumination(normal,d,s,p); for(i = 0; i < 3; i++){ buffer[y*thescene.screen_w+x].rgba[i] = illuColor[i]; } buffer[y*thescene.screen_w+x].z = z; } } } } alpha += x_incr_alpha; beta += x_incr_beta; gamma += x_incr_gamma; } alpha0 += y_incr_alpha; beta0 += y_incr_beta; gamma0 += y_incr_gamma; } }
void Tutorial(int& scene, Font& font) { //画像呼び込み Texture floor_image("res/image/floor.png"); Texture dog_image("res/image/dog.png"); Texture skeleton_image("res/image/skeleton.png"); //背景画像 Random rand; rand.setSeed(std::time(nullptr)); int bg_count = rand(0, 5); Texture bg; Texture bg2; Vec2f bg_pos = Vec2f(-WIDTH / 2, -HEIGHT / 2); Vec2f bg2_pos = Vec2f(WIDTH * 3 / 2, -HEIGHT / 2); switch (bg_count) { case 0: bg = Texture("res/image/gm_bg.png"); bg2 = Texture("res/image/gm_bg.png"); break; case 1: bg = Texture("res/image/gm_bg2.png"); bg2 = Texture("res/image/gm_bg2.png"); break; case 2: bg = Texture("res/image/gm_bg3.png"); bg2 = Texture("res/image/gm_bg3.png"); break; case 3: bg = Texture("res/image/gm_bg4.png"); bg2 = Texture("res/image/gm_bg4.png"); break; case 4: bg = Texture("res/image/gm_bg5.png"); bg2 = Texture("res/image/gm_bg5.png"); break; case 5: bg = Texture("res/image/gm_bg6.png"); bg2 = Texture("res/image/gm_bg6.png"); break; } //サウンド Media skeletonjump("res/sound/skeletonjump.wav"); Media dogjump("res/sound/dogjump.wav"); Media dogdash("res/sound/dogdash.wav"); Media skeletondash("res/sound/skeletondash.wav"); //決定音 Media decision("res/sound/decision.wav"); //ポーズ Color color1 = Color::red; Color color2 = Color::white; int count = 0; //for文で使う int i; int k; //アニメーション int index = 4; int index2 = 0; int animation_count = 0; //プレイヤー Player skeleton, dog; //プレイヤー (ガイコツ) skeleton.pos.x() = 0.0f; skeleton.pos.y() = -160.0f; skeleton.size.x() = 64.0f; skeleton.size.y() = 80.0f; skeleton.vector.x() = 15.0f; skeleton.vector.y() = 0.0f; skeleton.jumpflag = false; skeleton.speedupflag = false; //プレイヤー (犬) dog.pos.x() = -700.0f; dog.pos.y() = -160.0; dog.size.x() = 128.0f; dog.size.y() = 64.0f; dog.vector.x() = 14.0f; dog.vector.y() = 0.0f; dog.jumpflag = false; dog.speedupflag = false; //床 Object floor; //ステータス Status status; status.camera = 0.0f; status.scroll = 20.0; status.gravity = 0.2f; status.pose = false; //床 int mapchip[Geography::HEIGHTNUM][Geography::WIDTHNUM] = { //20 //50 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; float mapchip_pos_x[Geography::HEIGHTNUM][Geography::WIDTHNUM]; float mapchip_pos_y[Geography::HEIGHTNUM][Geography::WIDTHNUM]; float map_pos_x = -2048.0f; float map_pos_y = 352.0f; float map_size_xy = 128.0f; for (i = 0; i < Geography::HEIGHTNUM; ++i) { for (k = 0; k < Geography::WIDTHNUM; ++k) { mapchip_pos_x[i][k] = map_pos_x; mapchip_pos_y[i][k] = map_pos_y; map_pos_x += map_size_xy; } map_pos_x = -2048.0f; map_pos_y -= map_size_xy; } ///////////////////////////////////////////////////////////////////////////////////////////// //チュートリアルスタート前 Vec2f size = Vec2f(2048.0f, 512.0f); while (size.y() != 0.0f) { if (!env.isOpen()){ exit(0); } size.y() -= 8.0f; env.begin(); drawTextureBox(-WIDTH / 2, -HEIGHT / 2, WIDTH, HEIGHT, 0, 0, WIDTH, HEIGHT, bg); //地形 for (i = 0; i < Geography::HEIGHTNUM; ++i) { for (k = 0; k < Geography::WIDTHNUM; ++k) { if (mapchip[i][k] == FLOOR) { if (mapchip_pos_x[i][k] + map_size_xy - status.camera >= -(WIDTH / 2) && mapchip_pos_x[i][k] - status.camera < WIDTH / 2) { drawTextureBox(mapchip_pos_x[i][k] - status.camera, mapchip_pos_y[i][k], map_size_xy, map_size_xy, 0, 0, 64, 64, floor_image); } } if (mapchip[i][k] == FACE) { drawTextureBox(mapchip_pos_x[i][k] - status.camera, mapchip_pos_y[i][k], map_size_xy, map_size_xy, 0, 0, 192, 64, floor_image); } } } //犬 drawTextureBox(dog.pos.x() - status.camera, dog.pos.y(), dog.size.x(), dog.size.y(), 128 * index, 0, 100, 50, dog_image); //ガイコツ drawTextureBox(skeleton.pos.x() - status.camera, skeleton.pos.y(), skeleton.size.x(), skeleton.size.y(), 128 * index2 + 30, 0, 98, 230, skeleton_image); drawFillBox(-WIDTH / 2, -HEIGHT / 2, size.x(), size.y(), Color::black); drawFillBox(-WIDTH / 2, HEIGHT / 2, size.x(), -size.y(), Color::black); env.end(); } ///////////////////////////////////////////////////////////////////////////////////////////// //チュートリアル while (scene == TUTORIAL || decision.isPlaying()) { if (!env.isOpen()){ exit(0); } env.begin(); //重力 Gravity(skeleton, dog, status); //速度、ジャンプ Move(skeletonjump, dogjump, dogdash, skeletondash, dog, skeleton, status); //当たり判定 for (i = 0; i < Geography::HEIGHTNUM; ++i) { for (k = 0; k < Geography::WIDTHNUM; ++k) { if (mapchip[i][k] == Geography::FLOOR) { floor.pos = Vec2f(mapchip_pos_x[i][k], mapchip_pos_y[i][k]); floor.size = Vec2f(map_size_xy, map_size_xy); HitFlag(skeleton, floor, status, mapchip[i - 1][k], mapchip[i - 1][k + 1], mapchip[i][k + 1], mapchip[i + 1][k], i, k); HitFlag(dog, floor, status, mapchip[i - 1][k], mapchip[i - 1][k + 1], mapchip[i][k + 1], mapchip[i + 1][k], i, k); } } } //リスタート Restart(dog, skeleton, status); //無限生成 Repeat(skeleton, dog, status, mapchip_pos_x[0][314], bg_pos, bg2_pos); ///////////////////////////////////////////////////////////////////////// //ポーズ Pose(font, scene, status, skeleton, dog, color1, color2, count, decision); ///////////////////////////////////////////////////////////////////////// //アニメーション Animation(index, index2, animation_count); //////////////////////////////////////////////////////////////////////// //背景ループ //////////////////////////////////////////////////////////////////////// Bg(bg_pos, bg2_pos, status); /////////////////////////////////////////////////////////////////////// //表示処理 drawTextureBox(bg_pos.x() - status.camera, bg_pos.y(), WIDTH, HEIGHT, 0, 0, WIDTH, HEIGHT, bg); drawTextureBox(bg2_pos.x() - status.camera, bg2_pos.y(), -WIDTH, HEIGHT, 0, 0, WIDTH, HEIGHT, bg2); //地形 for (i = 0; i < Geography::HEIGHTNUM; ++i) { for (k = 0; k < Geography::WIDTHNUM; ++k) { if (mapchip[i][k] == FLOOR) { if (mapchip_pos_x[i][k] + map_size_xy - status.camera >= -(WIDTH / 2) && mapchip_pos_x[i][k] - status.camera < WIDTH / 2) { drawTextureBox(mapchip_pos_x[i][k] - status.camera, mapchip_pos_y[i][k], map_size_xy, map_size_xy, 0, 0, 64, 64, floor_image); } } if (mapchip[i][k] == FACE) { drawTextureBox(mapchip_pos_x[i][k] - status.camera, mapchip_pos_y[i][k], map_size_xy, map_size_xy, 0, 0, 192, 64, floor_image); } } } //犬 font.draw("A / ダッシュ", Vec2f(dog.pos.x() + dog.size.x() / 2 - font.drawSize("A / ダッシュ").x() / 2 - status.camera, dog.pos.y() + dog.size.y() + font.drawSize("A / ダッシュ").y() * 2), Color::lime); font.draw("S / ジャンプ", Vec2f(dog.pos.x() + dog.size.x() / 2 - font.drawSize("A / ダッシュ").x() / 2 - status.camera, dog.pos.y() + dog.size.y() + font.drawSize("A / ダッシュ").y()), Color::lime); drawTextureBox(dog.pos.x() - status.camera, dog.pos.y(), dog.size.x(), dog.size.y(), 128 * index, 0, 100, 50, dog_image); //ガイコツ font.draw("K / ダッシュ", Vec2f(skeleton.pos.x() + skeleton.size.x() / 2 - font.drawSize("K / ダッシュ").x() / 2 - status.camera, skeleton.pos.y() + skeleton.size.y() + font.drawSize("K / ダッシュ").y() * 2), Color::red); font.draw("L / ジャンプ", Vec2f(skeleton.pos.x() + skeleton.size.x() / 2 - font.drawSize("L / ジャンプ").x() / 2 - status.camera, skeleton.pos.y() + skeleton.size.y() + font.drawSize("L / ジャンプ").y()), Color::red); font.draw("SPACE / ポーズ", Vec2f(WIDTH / 2 - font.drawSize("SPACE / ポーズ").x(), -HEIGHT / 2), Color::yellow); drawTextureBox(skeleton.pos.x() - status.camera, skeleton.pos.y(), skeleton.size.x(), skeleton.size.y(), 128 * index2 + 30, 0, 98, 230, skeleton_image); //ポーズ if (status.pose == true) { drawFillBox(-WIDTH / 2, -HEIGHT / 2, WIDTH, HEIGHT, Color(0.0f, 0.0f, 0.0f, 0.7f)); font.draw("タイトル", Vec2f(0, 80) - font.drawSize("タイトル") / 2, color1); font.draw("再開", Vec2f(0, -80) - font.drawSize("再開") / 2, color2); } env.end(); } env.flushInput(); }
int main (int argc, char *argv[]) { /* if(argc < 2) { printf("manque arg"); } else { if(argc >= 3) { */ //deux argument:= 1er grey pour la fonction et le deuxième un nom d'image :appeler if((strcmp(argv[1],"grey"))==0) { /* SDL_Surface *surface=IMG_Load(argv[2]); goToGrey(surface);*/ example* arr; image *tab = malloc(797*sizeof(image)); arr=weightImage(tab, 797, 797); float tab1[4]={-972.0,-1.0,0.222619,24.0}; float tab2[4]={3564.0,1.0,0.204066,24.0}; float tab3[4]={-1165.5,-1.0,0.198428,21.0}; float tab4[4]={1310.0,1.0,0.209290,20.0}; float tab5[4]={751.5,1.0,0.199548,9.0}; float tab6[4]={1190.0,1.0,0.204657,20.0}; float tab7[4]={8061.5,1.0,0.178388,23.0}; float tab8[4]={-504.0,-1.0,0.214318,16.0}; float tab9[4]={-4092.0,-1.0,0.170897,24.0}; float tab10[4]={-298.5,-1.0,0.178046,3.0}; float tab11[4]={6309.0,1.0,0.144317,18.0}; float tab12[4]={143.5,1.0,0.157750,7.0}; float tab13[4]={4826.0,1.0,0.248784,38.0}; float tab14[4]={-4212.0,-1.0,0.181252,24.0}; float tab15[4]={-1092.0,-1.0,0.191624,24.0}; float tab16[4]={8412.0,1.0,0.109095,24.0}; float tab17[4]={112.5,1.0,0.104319,3.0}; float tab18[4]={-175.5,-1.0,0.166597,1.0}; float tab19[4]={4109.0,1.0,0.140488,42.0}; float tab20[4]={3173.0,1.0,0.158814,38.0}; float tab21[4]={1914.0,1.0,0.133727,12.0}; float tab22[4]={13.0,1.0,0.158362,2.0}; float tab23[4]={262.5,1.0,0.149735,5.0}; //evaluation prend en param: example *arr, int i(ieme image) // creer nb = nbligne dans fichier ,tab, lis dans le fichier et le remplis (avec serateurs...) // creer float = tab[4] * evaluate(tab, arr[i].feat[tab[3]]) for(int z=0;z<797;z++) {float a=0.630079*evaluate(tab1,arr[z].feat[81095]); float b=0.692751*evaluate(tab2,arr[z].feat[103319]); float c=0.702541*evaluate(tab3,arr[z].feat[81556]); float d=0.672720*evaluate(tab4,arr[z].feat[105231]); float e=0.699813*evaluate(tab5,arr[z].feat[109008]); float f=0.685823*evaluate(tab6,arr[z].feat[105342]); float g=0.772684*evaluate(tab7,arr[z].feat[99628]); float h=0.654340*evaluate(tab8,arr[z].feat[85502]); float i=0.796683*evaluate(tab9,arr[z].feat[77819]); float j=0.770885*evaluate(tab10,arr[z].feat[72880]); float k=0.900025*evaluate(tab11,arr[z].feat[99926]); float l=0.843853*evaluate(tab12,arr[z].feat[110235]); float m=0.557756*evaluate(tab13,arr[z].feat[99462]); float n=0.756812*evaluate(tab14,arr[z].feat[77819]); float o=0.726207*evaluate(tab15,arr[z].feat[77771]); float p=1.068905*evaluate(tab16,arr[z].feat[99467]); float q=1.084687*evaluate(tab17,arr[z].feat[110324]); float r=0.804995*evaluate(tab18,arr[z].feat[72632]); float s=0.915483*evaluate(tab19,arr[z].feat[95971]); float t=0.840918*evaluate(tab20,arr[z].feat[99757]); float u=0.943950*evaluate(tab21,arr[z].feat[106812]); float v=0.840947*evaluate(tab22,arr[z].feat[110893]); float w=0.881422*evaluate(tab23,arr[z].feat[108866]); printf("%f\n",a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w);} } // 2 argument:= 1er integral pour la fonction et le deuxième un nom d'image:appeler if((strcmp(argv[1],"integral"))==0) { SDL_Surface *surface=IMG_Load(argv[2]); int **arr= Integral(surface); printf("%d\n%d\n", getpixel(surface,0,0), getpixel(surface,0,1)); printf("%d\n",arr[0][1]); } //2 argument:= 1er haar pour la fonction et le deuxième un nom d'image:appeler if((strcmp(argv[1],"haar"))==0) { /*SDL_Surface *surface=IMG_Load(argv[2]); feature *q=haarr2(surface); if(argc==4) {printf("Le caractéristique %d vaut %d\n",atoi(argv[3]),(q[atoi(argv[3])]).res);}*/ eval(); } //2 argument 1er decision 2eme entier i: appeler if((strcmp(argv[1],"decision"))==0) { example* arr; image *tab = malloc(797*sizeof(image)); arr=weightImage(tab, 797, 797); quickSort(arr,0,796,atoi(argv[2])); float *t=decision(arr,(atoi(argv[2])),796); printf("%f|",t[0]); printf("%f|",t[1]); printf("%f|",t[2]); printf("%f|",t[3]); printf("%f|",t[4]); printf("\n"); } //2 argument adaboost pour la fonction entier T pour le nombre de tour:appeler if((strcmp(argv[1],"adaboost"))==0) { example* arr; image *tab = malloc(797*sizeof(image)); arr=weightImage(tab, 797, 797); adaboost(arr,atoi(argv[2]),320); } // if(argc == 2) // { //1 argument 1er image pour la fonction:appeler if((strcmp(argv[1],"image"))==0) { example* arr; image *tab = malloc(797*sizeof(image)); arr=weightImage(tab, 797, 797); } /* } if(argc > 2) { */ if(strcmp(argv[1], "bd") == 0) { CharacterInfo *c = NULL; c= ArrayData(); char *a = "jerome", *b = "guillaume", *e= "valentin", *d = NULL; char **tab = malloc(4 * sizeof(a)); tab[0] = a; tab[1] = b; tab[2] = e; tab[3] = d; printf("enter\n\n\n"); if(strcmp(argv[2],"-add")==0) { printf("addddddddddddddddddd!"); c=AddInfo(c, argv[3]); } if(strcmp(argv[2],"-addBatch")==0) { c=AddBatch(c, tab); } if(strcmp(argv[2], "-remove")==0) { c=RemoveInfo(c, argv[3]); } if(strcmp(argv[2] , "-modif")==0) { ModifInfo(c, argv[3], argv[4]); } if(strcmp(argv[2], "-ls")==0) { ShowList(c); } /* } } else { printf("erreur arg"); } }*/ } return 0; }