Exemple #1
0
void FilterTwoPole::setAsFilter( OSCILLATOR_TYPE ft, float frequency3db, float initialValue ) {
  // if this is a highpass filter, set to invert the transfer function on the output
  //if( ft == HIGHPASS_BESSEL || ft == HIGHPASS_BUTTERWORTH ) {
  //  IsHighpass = true;
  //}
  //else {
    IsHighpass = false;
  //}

  X = initialValue;
  
  if( ft == LOWPASS_BESSEL ) {
    setFrequency0( frequency3db * 1.28 );
    setQ( 0.5774 );
  }
  //else if( ft == HIGHPASS_BESSEL ) {
  //  setFrequency0( frequency3db * 1.28 );
  //  setQ( 0.5774 );
  //}
  
  else if( ft == LOWPASS_BUTTERWORTH ) {
    // set as butterworth
    setFrequency0( frequency3db );
    setQ( 0.7071 );
  }
  //else if( ft == HIGHPASS_BUTTERWORTH ) {
    // set as butterworth
  //  setFrequency0( frequency3db );
  //  setQ( 0.7071 );
  //}
}
bool RSAPrivateKey::deserialise(ByteString& serialised)
{
	ByteString dP = ByteString::chainDeserialise(serialised);
	ByteString dQ = ByteString::chainDeserialise(serialised);
	ByteString dPQ = ByteString::chainDeserialise(serialised);
	ByteString dDP1 = ByteString::chainDeserialise(serialised);
	ByteString dDQ1 = ByteString::chainDeserialise(serialised);
	ByteString dD = ByteString::chainDeserialise(serialised);
	ByteString dN = ByteString::chainDeserialise(serialised);
	ByteString dE = ByteString::chainDeserialise(serialised);

	if ((dD.size() == 0) ||
	    (dN.size() == 0) ||
	    (dE.size() == 0))
	{
		return false;
	}

	setP(dP);
	setQ(dQ);
	setPQ(dPQ);
	setDP1(dDP1);
	setDQ1(dDQ1);
	setD(dD);
	setN(dN);
	setE(dE);

	return true;
}
// Set from OpenSSL representation
void OSSLDSAPrivateKey::setFromOSSL(const DSA* dsa)
{
	if (dsa->p) { ByteString p = OSSL::bn2ByteString(dsa->p); setP(p); }
	if (dsa->q) { ByteString q = OSSL::bn2ByteString(dsa->q); setQ(q); }
	if (dsa->g) { ByteString g = OSSL::bn2ByteString(dsa->g); setG(g); }
	if (dsa->priv_key) { ByteString x = OSSL::bn2ByteString(dsa->priv_key); setX(x); }
}
Exemple #4
0
void SimObjBase::setRotation(const Rotation &r)
{
	if (dynamics()) { return; }
	
	const dReal *q = r.q();
	setQ(q);
}
// Set from OpenSSL representation
void OSSLDSAPublicKey::setFromOSSL(const DSA* inDSA)
{
	const BIGNUM* bn_p = NULL;
	const BIGNUM* bn_q = NULL;
	const BIGNUM* bn_g = NULL;
	const BIGNUM* bn_pub_key = NULL;

	DSA_get0_pqg(inDSA, &bn_p, &bn_q, &bn_g);
	DSA_get0_key(inDSA, &bn_pub_key, NULL);

	if (bn_p)
	{
		ByteString inP = OSSL::bn2ByteString(bn_p);
		setP(inP);
	}
	if (bn_q)
	{
		ByteString inQ = OSSL::bn2ByteString(bn_q);
		setQ(inQ);
	}
	if (bn_g)
	{
		ByteString inG = OSSL::bn2ByteString(bn_g);
		setG(inG);
	}
	if (bn_pub_key)
	{
		ByteString inY = OSSL::bn2ByteString(bn_pub_key);
		setY(inY);
	}
}
Exemple #6
0
int setQ( int y, int x) {
    int i;

    //check point routine
    for(i=0;i<pl.size;i++) {
        struct point pt = pl.arr[i];
        if(pt.x == x || pt.y-pt.x == y-x || pt.y+pt.x == y+x) return 0;
    }
    // add point routine
    pl.arr[pl.size].y = y;
    pl.arr[pl.size].x = x;
    pl.size++;

    if(rcnt < ROUTE_CNT) {
        route[rcnt][y] = x;
    }
    if(y == mapsize) {
        rcnt++;
    }

    for(i=1;i<=mapsize&& y < mapsize;i++) {
        setQ(y+1, i);
    }
    pl.size--;
    return 0;
}
Exemple #7
0
void PoldiPeak::multiplyErrors(double factor) {
  setQ(UncertainValue(m_q.value(), m_q.error() * factor));
  setFwhm(
      UncertainValue(m_fwhmRelative.value(), m_fwhmRelative.error() * factor),
      PoldiPeak::Relative);
  setIntensity(
      UncertainValue(m_intensity.value(), m_intensity.error() * factor));
}
/*
 *  void clear_point(uint8_t x, uint8_t y)
 *   Params: 
 *    - x,y coordinate
 */
void clear_point(uint8_t x, uint8_t y)
{
  if (x < 10 || y < 7) // top-left = (0,0), bottom_right = (9,6)
  {
    setQ(Q_array[x]);
    digitalWrite(RC_arr[y], LOW);
  }
}
Exemple #9
0
void SimObjBase::setAxisAndAngle(double ax, double ay, double az, double angle)
{
	if (dynamics()) { return; }

	Rotation r;
	r.setAxisAndAngle(ax, ay, az, angle);
	const dReal *q = r.q();
	setQ(q);
}
 void LQRBackup(const Eigen::Matrix<double,xDim,xDim> & A, 
     const Eigen::Matrix<double,xDim,uDim> & B, 
     const Eigen::Matrix<double,xDim,xDim> & Q, 
     const Eigen::Matrix<double,uDim,uDim> & R)
 {
   setQ(Q);
   setR(R);
   LQRBackup(A, B);
 }
Exemple #11
0
FilterTwoPole::FilterTwoPole( float frequency0, float qualityFactor, float xInit ) {
  X = xInit;              // start it some arbitrary position
  Vprev = 0;              // initially stopped
  IsHighpass = false;     // by default, a normal oscillator

  setQ( qualityFactor );
  setFrequency0( frequency0 );

  LastTimeUS = micros();
}
/*
 * void blink_point(uint8_t x, uint8_t y, uint16_t delay_time)
 *  Params:
 *   - x,y coordinate
 *   - delatime: time before clearing the point
 */
void blink_point(uint8_t x, uint8_t y, uint16_t delay_time)
{
  if (x < 10 || y < 7) // top-left = (0,0), bottom_right = (9,6)
  {
    setQ(Q_array[x]);
    digitalWrite(RC_arr[y], HIGH);
    delay(delay_time);
    digitalWrite(RC_arr[y], LOW);
  }
}
// Set from Botan representation
void BotanDSAPrivateKey::setFromBotan(const Botan::DSA_PrivateKey* dsa)
{
	ByteString p = BotanUtil::bigInt2ByteString(dsa->group_p());
	setP(p);
	ByteString q = BotanUtil::bigInt2ByteString(dsa->group_q());
	setQ(q);
	ByteString g = BotanUtil::bigInt2ByteString(dsa->group_g());
	setG(g);
	ByteString x = BotanUtil::bigInt2ByteString(dsa->get_x());
	setX(x);
}
// Set from Botan representation
void BotanDSAPrivateKey::setFromBotan(const Botan::DSA_PrivateKey* inDSA)
{
    ByteString inP = BotanUtil::bigInt2ByteString(inDSA->group_p());
    setP(inP);
    ByteString inQ = BotanUtil::bigInt2ByteString(inDSA->group_q());
    setQ(inQ);
    ByteString inG = BotanUtil::bigInt2ByteString(inDSA->group_g());
    setG(inG);
    ByteString inX = BotanUtil::bigInt2ByteString(inDSA->get_x());
    setX(inX);
}
Exemple #15
0
int setParamsN(element *e){
    int i,j,k;
    char buff[256];
    if(organizeNodes(e->no)<0){
        return(-1);
    }
    else{
        if(setP(e)<0 || setQ(e)<0 || setR(e)<0)
            return(-1);
    }
    return(0);
}
Exemple #16
0
EKF::EKF(int _n, int _m,
         void (*_f_func)(MatrixXd&,MatrixXd&,VectorXd&,const VectorXd&, const float dt),
         void (*_h_func)(MatrixXd&,VectorXd&,const VectorXd&, const VectorXd&),
         void (*_c_func)(const VectorXd &, VectorXd &),
         float _q, float _r)
{
    init_filter( _n, _m);

    f_func = _f_func;
    h_func = _h_func;
    c_func = _c_func;

    setQ(_q);
    setR(_r);
}
Exemple #17
0
/*!
 * @brief It rotates for the specification of the relative angle.
 * @param[in] x-axis rotation weather(i of quaternion complex part)
 * @param[in] y-axis rotation weather(j of quaternion complex part)
 * @param[in] z-axis rotation weather(k of quaternion complex part)
 * @param[in] flag for ansolute / relational (1.0=absolute, else=relational)
 */
void SimObjBase::setAxisAndAngle(double ax, double ay, double az, double angle, double direct)
{
  // The angle is used now at the relative angle specification.
  if (dynamics()) { return; }


  Rotation r;
  if (direct != 1.0) r.setQuaternion(qw(), qx(), qy(), qz());

  // alculate relational angle
  r.setAxisAndAngle(ax, ay, az, angle, direct);
  const dReal *q = r.q();
  setQ(q);

}
// Set from OpenSSL representation
void OSSLECPublicKey::setFromOSSL(const EC_KEY* eckey)
{
	const EC_GROUP* grp = EC_KEY_get0_group(eckey);
	if (grp != NULL)
	{
		ByteString ec = OSSL::grp2ByteString(grp);
		setEC(ec);
	}
	const EC_POINT* pub = EC_KEY_get0_public_key(eckey);
	if (pub != NULL && grp != NULL)
	{
		ByteString q = OSSL::pt2ByteString(pub, grp);
		setQ(q);
	}
}
bool ECPublicKey::deserialise(ByteString& serialised)
{
	ByteString dEC = ByteString::chainDeserialise(serialised);
	ByteString dQ = ByteString::chainDeserialise(serialised);

	if ((dEC.size() == 0) ||
	    (dQ.size() == 0))
	{
		return false;
	}

	setEC(dEC);
	setQ(dQ);

	return true;
}
// Set from Botan representation
void BotanGOSTPublicKey::setFromBotan(const Botan::GOST_3410_PublicKey* inECKEY)
{
	ByteString inEC = BotanUtil::ecGroup2ByteString(inECKEY->domain());
	setEC(inEC);

	ByteString inQ = BotanUtil::ecPoint2ByteString(inECKEY->public_point()).substr(3);

	/* The points must be stored in little endian */
	const size_t length = inQ.size() / 2;
	for (size_t i = 0; i < (length / 2); i++)
	{
		std::swap(inQ[i], inQ[length-1-i]);
		std::swap(inQ[length+i], inQ[2*length-1-i]);
	}

	setQ(inQ);
}
Exemple #21
0
void queens(int r,int n){
// recursive backtracking function
// r = row, n = board dimension
	
	int c ;  // column
	for (c = 1; c <= n ; c++){
		
		if(setQ(r,c)){ 	// if we are allowed to set the queen
			x[r-1] = c;
			if (r == n){ // no more columns to attempt to set
				save(n);
			} else{
				queens(r+1,n);
				x[r-1] = 0; // backtrack! 
			}
		}
	}
	iterations++;
}
// Set from Botan representation
void BotanRSAPrivateKey::setFromBotan(const Botan::RSA_PrivateKey* inRSA)
{
	ByteString inP = BotanUtil::bigInt2ByteString(inRSA->get_p());
	setP(inP);
	ByteString inQ = BotanUtil::bigInt2ByteString(inRSA->get_q());
	setQ(inQ);
	ByteString inDP1 = BotanUtil::bigInt2ByteString(inRSA->get_d1());
	setDP1(inDP1);
	ByteString inDQ1 = BotanUtil::bigInt2ByteString(inRSA->get_d2());
	setDQ1(inDQ1);
	ByteString inPQ = BotanUtil::bigInt2ByteString(inRSA->get_c());
	setPQ(inPQ);
	ByteString inD = BotanUtil::bigInt2ByteString(inRSA->get_d());
	setD(inD);
	ByteString inN = BotanUtil::bigInt2ByteString(inRSA->get_n());
	setN(inN);
	ByteString inE = BotanUtil::bigInt2ByteString(inRSA->get_e());
	setE(inE);
}
// Set from Botan representation
void BotanRSAPrivateKey::setFromBotan(const Botan::RSA_PrivateKey* rsa)
{
	ByteString p = BotanUtil::bigInt2ByteString(rsa->get_p());
	setP(p);
	ByteString q = BotanUtil::bigInt2ByteString(rsa->get_q());
	setQ(q);
	ByteString dp1 = BotanUtil::bigInt2ByteString(rsa->get_d1());
	setDP1(dp1);
	ByteString dq1 = BotanUtil::bigInt2ByteString(rsa->get_d2());
	setDQ1(dq1);
	ByteString pq = BotanUtil::bigInt2ByteString(rsa->get_c());
	setPQ(pq);
	ByteString d = BotanUtil::bigInt2ByteString(rsa->get_d());
	setD(d);
	ByteString n = BotanUtil::bigInt2ByteString(rsa->get_n());
	setN(n);
	ByteString e = BotanUtil::bigInt2ByteString(rsa->get_e());
	setE(e);
}
// Set from OpenSSL representation
void OSSLRSAPrivateKey::setFromOSSL(const RSA* inRSA)
{
	if (inRSA->p)
	{
		ByteString inP = OSSL::bn2ByteString(inRSA->p);
		setP(inP);
	}
	if (inRSA->q)
	{
		ByteString inQ = OSSL::bn2ByteString(inRSA->q);
		setQ(inQ);
	}
	if (inRSA->dmp1)
	{
		ByteString inDP1 = OSSL::bn2ByteString(inRSA->dmp1);
		setDP1(inDP1);
	}
	if (inRSA->dmq1)
	{
		ByteString inDQ1 = OSSL::bn2ByteString(inRSA->dmq1);
		setDQ1(inDQ1);
	}
	if (inRSA->iqmp)
	{
		ByteString inPQ = OSSL::bn2ByteString(inRSA->iqmp);
		setPQ(inPQ);
	}
	if (inRSA->d)
	{
		ByteString inD = OSSL::bn2ByteString(inRSA->d);
		setD(inD);
	}
	if (inRSA->n)
	{
		ByteString inN = OSSL::bn2ByteString(inRSA->n);
		setN(inN);
	}
	if (inRSA->e)
	{
		ByteString inE = OSSL::bn2ByteString(inRSA->e);
		setE(inE);
	}
}
Exemple #25
0
int main() {

    int i,j;
    scanf("%d", &mapsize);
    for(i=1;i<=mapsize;i++) {
        setQ(1, i);
    }

    for(i=0;i<ROUTE_CNT;i++) {
        for(j=1;j<=mapsize;j++){
            if(route[i][j] == 0)
                route[i][j] = route[i-1][j];
            printf("%d ", route[i][j]);
        }
        putchar('\n');
    }
    printf("%d\n", rcnt); 

    return 0;
}
Exemple #26
0
bool DSAPrivateKey::deserialise(ByteString& serialised)
{
	ByteString dP = ByteString::chainDeserialise(serialised);
	ByteString dQ = ByteString::chainDeserialise(serialised);
	ByteString dG = ByteString::chainDeserialise(serialised);
	ByteString dX = ByteString::chainDeserialise(serialised);

	if ((dP.size() == 0) ||
	    (dQ.size() == 0) ||
	    (dG.size() == 0) ||
	    (dX.size() == 0))
	{
		return false;
	}

	setP(dP);
	setQ(dQ);
	setG(dG);
	setX(dX);

	return true;
}
// Set from OpenSSL representation
void OSSLGOSTPublicKey::setFromOSSL(const EVP_PKEY* pkey)
{
	ByteString der;
	int len = i2d_PUBKEY((EVP_PKEY*) pkey, NULL);
	if (len != 37 + 64)
	{
		ERROR_MSG("bad GOST public key encoding length %d", len);
		return;
	}
	der.resize(len);
	unsigned char *p = &der[0];
	i2d_PUBKEY((EVP_PKEY*) pkey, &p);
	// can check: der is prefix + 64 bytes
	setQ(der.substr(37));

	ByteString inEC;
	const EC_KEY* eckey = (const EC_KEY*) EVP_PKEY_get0((EVP_PKEY*) pkey);
	int nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(eckey));
	inEC.resize(i2d_ASN1_OBJECT(OBJ_nid2obj(nid), NULL));
	p = &inEC[0];
	i2d_ASN1_OBJECT(OBJ_nid2obj(nid), &p);
	setEC(inEC);
}
Exemple #28
0
void PyLink::setPosture(double v)
{
    q = v;
    setQ(q);
    notifyChanged();
}
Exemple #29
0
int main(void)
{
//    int good = 0;
//    int numeroMap = 0;
//    do{
//        printf("Quelle map?\n");
//        printf("1 - Original\n");
//        printf("2 - Hard\n");
//        printf("3 - Lol\n");
//        printf("4 - Rez De chaussez Aile Sud Telecom Nancy\n");
//        scanf("%d", &numeroMap);
//        switch(numeroMap){
//            case 1:
//                loadMap("../projec/map/original.map");
//                good = 1;
//                break;
//            case 2:
//                loadMap("../projec/map/hard.map");
//                good = 1;
//                break;

//            case 3:
//                loadMap("../projec/map/maplol.map");
//                good = 1;
//                break;
//            case 4:
//                loadMap("../projec/map/rdastn.map");
//                good = 1;
//                break;

//            case 42:
//                loadMap("../projec/map/rdastn.map");
//                good = 1;
//                setQ();
//                break;
//        }
//    }while(!good);
    //Create SDL objects
    SDL_Window *window = 0;
    SDL_Event event;
    SDL_Renderer *renderer = 0;
    int terminate = 0;

    //Initialise SDL
    if(SDL_Init(SDL_INIT_VIDEO) < 0){
        printf("Error with SDL : %s\n", SDL_GetError());
        SDL_Quit();
        return EXIT_FAILURE;
    }

    window = SDL_CreateWindow("Pacman", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 544, 344, SDL_WINDOW_SHOWN);
    terminate = 0;
    renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
    SDL_Surface *menu = IMG_Load("../projec/texture/menu/menu.jpg");

    SDL_Texture *menuTexture = SDL_CreateTextureFromSurface(renderer, menu);

    SDL_FreeSurface(menu);
    SDL_RenderClear(renderer);
    int x, y;
    while(!terminate){
        SDL_Rect dest = {0, 0, 544, 344};
        SDL_RenderCopy(renderer, menuTexture, NULL, &dest);
        SDL_RenderPresent(renderer);
        SDL_WaitEvent(&event);
        switch(event.type){
            case SDL_MOUSEBUTTONDOWN:
                x = event.motion.x;
                y = event.motion.y;
                if(x >= 57 && x <= (57+54) && y >=  94 && y <= (94 + 74)){
                    loadMap("../projec/map/original.map");
                    terminate = 1;
                }
                if(x >= 124 && x <= (124+53) && y >=  208 && y <= (208 + 73)){
                    loadMap("../projec/map/hard.map");
                    terminate = 1;
                }
                if(x >= 221 && x <= (221+59) && y >=  95 && y <= (95 + 80)){
                    loadMap("../projec/map/maplol.map");
                    terminate = 1;
                }
                if(x >= 311 && x <= (311+63) && y >=  208 && y <= (208 + 76)){
                    loadMap("../projec/map/rdastn.map");
                    terminate = 1;
                }
                if(x >= 350 && x <= (350+124) && y >=  73 && y <= (73 + 109)){
                    loadMap("../projec/map/rdastn.map");
                    terminate = 1;
                    setQ();
                }
                break;
        }

        SDL_Delay(1000 / FPS);
    }
    SDL_DestroyTexture(menuTexture);

    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);

    //Search the pacman on the map and create him
    Pacman *pacman = getPacmanInstance();
    unsigned int initialX = pacman->x;
    unsigned int initialY = pacman->y;
    Map *map = getMapInstance();
    //If the pacman is not found
    if(!pacman){
        printf("Pacman not found on map\n");
        freeMap(map);
        exit(EXIT_FAILURE);
    }
    printf("Pacman found !\n");

    Ghost *clyde = searchAndCreateGhost(CLYDE);
    if(!clyde){
        printf("Clyde not found on map\n");
        freeMap(map);
        exit(EXIT_FAILURE);
    }
    printf("Clyde found !\n");

    Ghost *blinky = searchAndCreateGhost(BLINKY);
    if(!blinky){
        printf("Blinky not found on map\n");
        freeMap(map);
        freeGhost(clyde);
        exit(EXIT_FAILURE);
    }
    printf("Blinky found !\n");

    Ghost *inky = searchAndCreateGhost(INKY);
    if(!inky){
        printf("Inky not found on map\n");
        freeMap(map);
        freeGhost(clyde);
        freeGhost(blinky);
        exit(EXIT_FAILURE);
    }
    printf("Inky found !\n");

    Ghost *pinky = searchAndCreateGhost(PINKY);
    if(!pinky){
        printf("Pinky not found on map\n");
        freeMap(map);
        freeGhost(clyde);
        freeGhost(blinky);
        freeGhost(inky);
        exit(EXIT_FAILURE);
    }
    printf("Pinky found !\n");
    printf("SDL initialisation\n");



    if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 4096) == -1){
        printf("%s", Mix_GetError());
    }

    Mix_Music *music = NULL;
    music = Mix_LoadMUS("../projec/pacman.wav");
    if(!music){
        printf("Erreur de chargement de la musique %s \n", Mix_GetError());
    }else{
        Mix_VolumeMusic(MIX_MAX_VOLUME);
        Mix_PlayMusic(music, -1);
    }

    if(TTF_Init() == -1){
        printf("Error during TTF initialization : %s\n", TTF_GetError());
    }

    TTF_Font *police = NULL;

    police = TTF_OpenFont("../projec/monof.ttf", 65);
    if(!police){
        printf("Error during font load : %s\n", TTF_GetError());
    }
    SDL_Color color = { 255, 255, 255, 255};



    //Create the window
    window = SDL_CreateWindow("Pacman", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, TILE_SIZE * map->col, TILE_SIZE * map->row + TILE_SIZE, SDL_WINDOW_SHOWN);

    //If there is an error
    if(window == 0){
        printf("Error during window creation : %s \n", SDL_GetError());
        SDL_Quit();
        freeMap(map);
        return EXIT_FAILURE;
    }
    int j;
    printf("SDL init success\n");
    renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);

    //NEED gerer erreurs

    loadTextures(renderer);

    SDL_Surface *score = TTF_RenderText_Solid(police, "Score : ", color);
    SDL_Texture *scoreT = SDL_CreateTextureFromSurface(renderer, score);
    SDL_FreeSurface(score);
    char scoreString[15];

    SDL_Rect dest = {0, map->row * TILE_SIZE , map->row * TILE_SIZE / 6, 20};
    SDL_RenderCopy(renderer, scoreT, NULL, &dest);
    SDL_Surface *scoreN;
    SDL_Texture *scoreTN;
    int open = 0;
    int konami[10] = {0,0,0,0,0,0,0,0,0,0};
    //Infinite loop until we want to stop the game
    terminate = 0;
    while(!terminate){
        SDL_Rect dest2 = {map->row * TILE_SIZE / 6, map->row * TILE_SIZE, map->row * TILE_SIZE / 15, 20};
        sprintf(scoreString, "%d", pacman->point);
        scoreN = TTF_RenderText_Solid(police, scoreString, color);
        scoreTN = SDL_CreateTextureFromSurface(renderer, score);
        renderMap(renderer);
        open = renderPacman(open, renderer);
        renderClyde(clyde, renderer);
        renderBlinky(blinky, renderer);
        renderPinky(pinky, renderer);
        renderInky(inky, renderer);

        changeDirectionGhost(blinky);
        changeDirectionGhost(clyde);
        changeDirectionGhost(inky);
        changeDirectionGhost(pinky);
        SDL_Rect dest = {0, map->row * TILE_SIZE , map->row * TILE_SIZE / 6, 20};
        SDL_RenderCopy(renderer, scoreT, NULL, &dest);



        SDL_RenderCopy(renderer, scoreTN, NULL, &dest2);

        SDL_RenderPresent(renderer);
        //Event handling

        SDL_PollEvent(&event);
        switch(event.type){
            case SDL_KEYDOWN:
                switch(event.key.keysym.scancode){
                    case SDL_SCANCODE_UP:
                        setPacmanDirection(NORTH);
                        if(konami[0]){
                            if(konami[1]){
                                for(j = 0 ; j < 10 ; j++){
                                    konami[j] = 0;
                                }
//                                printf("Déjà deux\n");
                            }else{
                                konami[1] = 1;
                            }
                        }else{
                            konami[0] = 1;
                        }
                        break;
                    case SDL_SCANCODE_DOWN:
                        setPacmanDirection(SOUTH);
                        break;
                    case SDL_SCANCODE_RIGHT:
                        setPacmanDirection(EAST);
                        break;
                    case SDL_SCANCODE_LEFT:
                        setPacmanDirection(WEST);
                        break;
                    default:
                        break;
                }
                break;
        }
        terminate = update(clyde, blinky, inky, pinky);
        if(terminate){
            if(pacman->life > 0 ){
                pacman->life--;
                terminate = 0;
                pacman->x = initialX;
                pacman->y = initialY;
            }
        }
        if(event.window.event == SDL_WINDOWEVENT_CLOSE){
            terminate = 1;
        }
        SDL_Delay(1000 / FPS);
        SDL_DestroyTexture(scoreTN);
        SDL_FreeSurface(scoreN);
    }
    printf("Score final : %d\n", pacman->point);
    Mix_FreeMusic(music);
    Mix_CloseAudio();
    freeTextures();
    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    SDL_Quit();
    SDL_DestroyTexture(scoreT);
    freePacman();
    freeGhost(clyde);
    freeGhost(blinky);
    freeGhost(inky);
    freeGhost(pinky);
    freeMap();
    TTF_CloseFont(police);
    TTF_Quit();
    return EXIT_SUCCESS;
}