Beispiel #1
0
int IA::setPositionIA(sf::Time elapsedTimeInSecond, Map map){

    const glm::vec3 directionInitiale = glm::vec3(0.f, 0.f, -1.f);


    glm::vec3 vecdirecteur= glm::normalize(glm::toMat3(orientation)*directionInitiale);
    float x= map.trajet[getCursor()].x-(this->getPosition()[0]);
    float y= map.trajet[getCursor()].y-(this->getPosition()[1]);
    float z= map.trajet[getCursor()].z-(this->getPosition()[2]);
    int nb_noeud=map.getNbPoints();



   glm::vec3 kartToCheckpoint=glm::vec3(x,y,z);


   glm::vec2 kartToCheckpoint2 = glm::vec2(kartToCheckpoint.x, kartToCheckpoint.z);
   float angle = glm::orientedAngle(glm::normalize(kartToCheckpoint2), glm::normalize(glm::vec2(0.0f,-1.0f)));


   angleDirection = angle;

    mettreAJour(elapsedTimeInSecond);
    if (fabs(this->getPosition()[0]-map.trajet[getCursor()].x)<4.f && fabs(this->getPosition()[2]-map.trajet[getCursor()].z)<4.f){
        incrementCursor();
        setFalseTargetCalculate();
        if(getCursor()==nb_noeud-1){
            stopAvancer();
            arived=true;
        }
    }else{
        avance();
    }

}
Beispiel #2
0
int main(int argc, char **argv)
{
    int y0, m0, j0, h0, mn0, s0, t0;
    int y1, m1, j1, h1, mn1, s1, t1;
    int ns1, ns2;

    FILE *f;
    char buf[100];
    int d=0,i;
    int *periodes=NULL;
    int nbl, lg;
    unsigned char *motif=NULL;
    int l;
    char *lieu[2]={"Mer", "Terre"};
    
    y0 = atoi(argv[2]); m0 = atoi(argv[3]); j0 = atoi(argv[4]);
    if (argv[5][0]=='M') {
        l=0;
    } else {
        l=1;
    }
    FOPEN (f, argv[1], "w" );
    fprintf(f,"Début => Fin => Lieu\n");
    for(i=6;i<argc;i++)
    {
        avance(y0,m0,j0,atoi(argv[i]),&y1,&m1,&j1);
        fprintf(f,"%4d-%02d-%02d_00:00:00 %4d-%02d-%02d_00:00:00 %s\n",y0,m0,j0,y1,m1,j1,lieu[l]);
        l = !l;
        y0=y1; m0=m1; j0=j1;
    }
    fclose(f);
     
    return 0;
}
Beispiel #3
0
void dessinArbre2(int lg, int x, int y, int angle){
	int nx, ny, feuille=10;
	if(lg<feuille*2)
		fruits_rouges(x,y);

	lg+= (int) 0.1*aleat(lg);
	avance(lg,x,y,angle,&nx,&ny);
	lg=2*lg/3;
	if(lg>feuille+4){
		int n=3+aleat(3);
		int i;
		for(i=1;i<=n;i++){
			dessinArbre2(lg,nx,ny,angle-70+i*25);
		}
	}
	else if(lg>feuille-4){
		setcolor(newcolor(0,1,0));
		int n=3+aleat(3);
				int i;
				for(i=1;i<=n;i++){
					dessinArbre2(lg,nx,ny,angle-70+i*25);
				}
		setcolor(newcolor(0.5,0.3,0.08));
	}
}
Beispiel #4
0
int			ai(t_infos *infos)
{
  static int		i = 0;

  if (!i)
    {
      gauche(infos);
      i++;
    }
  avance(infos);
  return (RETURN_SUCCESS);
}
Beispiel #5
0
int		com_avance(t_server *s, char **tab, int sock)
{
  t_client	*client;

  UNUSED(tab);
  client = s->client;
  while (client != NULL)
    {
      if (client->sock == sock && client->type == 1)
	{
	  avance(s, client);
	  if (s->sock_graph > 0)
	    send_position(client, s->sock_graph);
	  return (return_ok(sock));
	}
      client = client->next;
    }
  return (0);
}
Beispiel #6
0
void strategie( void ){
  avance(10,AVANCE);
  avance(10,RECULE);
}
Beispiel #7
0
void BalleCB::run() {
	// Fait avancer la balle
	while (avance()) {
	}
}