Point PatchMatcher::getNewOffset(bool *foundMask) const {

    int minX, maxX, minY, maxY;
    getBoundaries(*outputMask, &minX, &maxX, &minY, &maxY);

    if (maxX < 0 || maxY < 0) {
        *foundMask = false;
        return Point(randRange(0, outputMask->width()  - patch->width()  + 1),
                     randRange(0, outputMask->height() - patch->height() + 1));
    } else {
        *foundMask = true;

        Image<float> C;

        // Compute allowed translations window
        minX = max(0, minX - patch->width()  + OVERLAP_WIDTH);
        minY = max(0, minY - patch->height() + OVERLAP_WIDTH);
        maxX = min(output->width()  - 1, maxX + patch->width()  - OVERLAP_WIDTH);
        maxY = min(output->height() - 1, maxY + patch->height() - OVERLAP_WIDTH);
        const Rect outputRect(minX, minY, maxX - minX + 1, maxY - minY + 1);

        Mat patchF, outputF;
        assert(patch->type() == CV_8UC3);
        assert(output->type() == CV_8UC3);

        patch->convertTo(patchF, CV_32FC3);
        ((Mat) *output)(outputRect).convertTo(outputF, CV_32FC3);

        matchTemplate(outputF, patchF, C, TM_SQDIFF);

        exp(C * factor, C);

//        imshow("C", C.greyImage());

        float acc, *data = (float *) C.data;

        for (int i = 0; i < C.height() * C.width(); i++) {
            acc += data[i];
            data[i] = acc;
        }

        int a = 0, b = C.height() * C.width() - 1;
        const float p = data[b] * (static_cast <float> (rand()) / static_cast <float> (RAND_MAX));

        // Dichotomy search
        while (b - a > 0) {
            const int m = (a + b) / 2;
            if (p > data[m])
                a = m + 1;
            else
                b = m;
        }

        // Seems to work
//        assert(p <= data[a] && (a == 0 || p > data[a-1]));
//        assert(data[a] == C(a % C.width(), a / C.width()));

        return Point(minX + a % C.width(), minY + a / C.width());
    }
}
Example #2
0
char* getPwd(int length)
{
    static char buffer[MAXLENGTH];  /* Generated password string */
    int  endnum;			/* Trailing digits */
    int  wordlength;		/* Length of the alphabetical character string */
    int  vowflag = 0;		/* Flag is zero if the previous member of the string was not a vowel*/
    int  i, cx = 0, index;

    /* Generate the letters */

    wordlength = length - 2;	/*Since there are two trailing digits, the wordlength is the full length minus two */

    for (i = 0; i < wordlength; i++) {
        if (vowflag == 0 && i != (wordlength - 1)) {
            index = randRange(10);  /* Generates a random integer between 0 and 9 */
            cx += snprintf (buffer + cx, length + 1 - cx, "%c", vowels[index]);
            vowflag = 1;
        }

        else {
            index = randRange(26);
            cx += snprintf (buffer + cx, length + 1 - cx, "%c", consonants[index]);
            vowflag = 0;
        }
    }

    /* Generate the trailing digits */

    endnum = randRange(90) + 10;
    snprintf (buffer + cx, length + 1 - cx, "%d", endnum);

    return buffer;
}
Example #3
0
ciclista newCiclista(int id) {
    ciclista c;
    AUTOMALLOC(c);
    
    c->id = id;
    c->nome = geraNome(id);
    c->km = -1;
    c->metros = 1000;
    c->trecho_atual = NULL;
    c->kms_no_trecho = 0;
    c->tempo_gasto_total = 0;
    c->numero_trecho_atual = 0;

    if(modo_simula) {
        c->vel_descida = randRange(20.0, 80.0);
        c->vel_plano   = randRange(20.0, 80.0);
        c->vel_subida  = randRange(20.0, 80.0);
    } else 
        c->vel_descida = c->vel_plano = c->vel_subida = 50.0;

    c->ponto_verde = 0;
    c->ponto_branco_vermelho = 0;
    sem_init(&c->terminou_ciclo, 0, 0);
    sem_init(&c->continua_ciclo, 0, 0);
    return c;
}
Example #4
0
static void show_stroke(SkCanvas* canvas, bool doAA, SkScalar strokeWidth, int n) {
    SkRandom rand;
    SkPaint paint;
    paint.setAntiAlias(doAA);
    paint.setStyle(SkPaint::kStroke_Style);
    paint.setStrokeWidth(strokeWidth);
    
    for (int i = 0; i < n; ++i) {
        SkRect r;
        SkPath p;
        
        r.setXYWH(rand.nextSScalar1() * W, rand.nextSScalar1() * H,
                  rand.nextUScalar1() * W, rand.nextUScalar1() * H);
        paint.setColor(rand.nextU());
        canvas->drawRect(r, paint);
        
        r.setXYWH(rand.nextSScalar1() * W, rand.nextSScalar1() * H,
                  rand.nextUScalar1() * W, rand.nextUScalar1() * H);
        paint.setColor(rand.nextU());
        p.addOval(r);
        canvas->drawPath(p, paint);

        const SkScalar minx = -SkIntToScalar(W)/4;
        const SkScalar maxx = 5*SkIntToScalar(W)/4;
        const SkScalar miny = -SkIntToScalar(H)/4;
        const SkScalar maxy = 5*SkIntToScalar(H)/4;
        paint.setColor(rand.nextU());
        canvas->drawLine(randRange(rand, minx, maxx), randRange(rand, miny, maxy),
                         randRange(rand, minx, maxx), randRange(rand, miny, maxy),
                         paint);
    }
}
/**
 * Generar direcciones aleatorias
 */
void Model_Robot::genDirec() {
  for (int i = 0; i < QUIT; i++) {
    int s = randRange(-2, 2);
    while (s == 0)
      s = randRange(-2, 2);
    this->direccion[i] = s;
  }
}
Example #6
0
File: R.cpp Project: Marneus68/rog
 void Rgame::resetMap(void)
 {
     newMap = new Rmap();
     mapSpr = newMap->GetSprite();
     
     while (mapSpr.GetPixel(hero.x, hero.y) == Color::Black)
     {
         hero.x = randRange(0, mapSpr.GetSize().x);
         hero.y = randRange(0, mapSpr.GetSize().y);
     }
 }
Example #7
0
// setup a move to a point.  width and height is included for some variation
void MoveMouse(int x, int y, int width, int height)
{
	if(!mouseMoving)
	{
		destX = x + randRange((width*-1)/2, width/2);
		destY = y + randRange((height*-1)/2, height/2);

		::SetTimer(NULL, NULL, randRange(5,30), MouseMoveUpdate);
		mouseMoving = 1;
	}
}
Example #8
0
cv::Vec3d alex::ObjectBase::randomChooseRayByBRDFDistribution(const cv::Vec3d &normalVecN) const {
  auto zAxis = normalVecN;
  auto yAxis = getAVerticalNVec(normalVecN);
  auto xAxis = yAxis.cross(zAxis);

  double theta = randRange(0, M_PI / 2);
  double phi = randRange(0, M_PI * 2);

  auto direction = zAxis * sin(theta) + (yAxis * cos(phi) + xAxis * sin(phi)) * cos(theta);

  return direction;
}
Example #9
0
void AltTab(char *match)
{
	FINDWINDOW	findwin;
	HWND		alttabWnd;
	ALTTABINFO	atinfo;
	char		buf[1024]	= {'\0'};
	int			i, current = 1, total=0;
	static int	failed = 0;

	if(failed) return; // TODO TEMP debugging crap

	atinfo.cbSize = sizeof(ALTTABINFO);

	::keybd_event(VK_MENU, 0, KEYEVENTF_EXTENDEDKEY, 0);
	::keybd_event(VK_TAB, 0, KEYEVENTF_EXTENDEDKEY, 0);
	::keybd_event(VK_TAB, 0, KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP, 0);

	findwin.find("#32771", 0, 0);
	alttabWnd = findwin.window;

	if(alttabWnd)
	{
		::GetAltTabInfo(alttabWnd, 0, &atinfo, NULL, NULL);

		for(i = 0; i < atinfo.cItems; i++)
		{
			::GetAltTabInfo(alttabWnd, i, &atinfo, buf, 1024);
			if(strstr(buf, match) != NULL)
				break;
		}
		while(current != i)
		{
			if(total++ > 50) // TODO temp ugly crap
			{
				Log("Alt tab failed for [%s]", match);
				failed = 1;
				break;
			}
			::keybd_event(VK_TAB, 0, KEYEVENTF_EXTENDEDKEY, 0);
			::keybd_event(VK_TAB, 0, KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP, 0);

			if(current == (atinfo.cItems-1))
				current = 0;
			else
				current++;

			::Sleep(randRange(50,300));
		}
	}
	::keybd_event(VK_MENU, 0, KEYEVENTF_EXTENDEDKEY|KEYEVENTF_KEYUP, 0);
	::Sleep(randRange(50,300));
}
// do the Allele selection
int randAllele(int numMom, int numDad, float selection) {
	if ((numMom == 0) && (numDad == 0)) {
		return 0;
	}
	else if ((numMom == 1) && (numDad == 0)) {
		return randInt(2);
	}
	else if ((numMom == 2) && (numDad == 0)) {
		return 1;
	}
	else if ((numMom == 0) && (numDad == 1)) {
		return randInt(2);
	}
	else if ((numMom == 1) && (numDad == 1)) {
		float val = randRange(0,(3+selection));
		if (val < 1.0) {
			return 0;
		}
		else if (val < 3.0) {
			return 1;
		}
		else {
			return 2;
		}
	}
	else if ((numMom == 2) && (numDad == 1)) {
		float val = randRange(0,(1+selection));
		if (val < 1.0) {
			return 1;
		}
		else {
			return 2;
		}
	}
	else if ((numMom == 0) && (numDad == 2)) {
		return 1;
	}
	else if ((numMom == 1) && (numDad == 2)) {
		float val = randRange(0,(1+selection));
		if (val < 1.0) {
			return 1;
		}
		else {
			return 2;
		}
	}
	else if ((numMom == 2) && (numDad == 2)) {
		return 2;
	}
}
Example #11
0
// UCB action selection strategy
action_t SearchNode::selectAction(Agent& agent, unsigned int dfr) {
    //choose unexplored action at random if any and append to tree
    if (!m_unexplored_actions.empty()) {
        int action_index = randRange(m_unexplored_actions.size());
        action_t action = m_unexplored_actions.at(action_index);
        m_unexplored_actions.erase(m_unexplored_actions.begin() + action_index);

        m_child[action] = new SearchNode(true, agent.numActions());
        return action;
    } else {
        action_t arg_max = 0;
        double C = sqrt(2);

        double max = (1.0 / (dfr * agent.maxReward())) * m_child[0]->m_mean
                    + C * sqrt((log(m_visits)/m_child[0]->m_visits));
        //search for argmax
        for (action_t a = 1; a < agent.numActions(); ++a) {
            double f = (1.0 / (dfr * agent.maxReward())) * m_child[a]->m_mean
                    + C * sqrt((log(m_visits)/m_child[a]->m_visits));
            // Notes: agent.minReward() defined as 0, so omitted.
            if (f > max) {
                max = f;
                arg_max = a;
            }
        }
        
        return arg_max;
    }
}
Example #12
0
int* generateRandomArray(int size) {
  int* result = (int *)malloc(sizeof(int)*size);
  for(int i=0; i < size; i++) {
    result[i] = randRange(size);
  }
  return result;
}
Example #13
0
char aggressiveKid(short angle, float front, float side)
{
	// Returns a char if buffer distance is broken.
	// If buffer not broken, it returns 'w'
	// after randomly moving a short distance
	getIR();                // Reads sensors
	if (lt <= side)       // Checks left buffer
	{
		SPKR_play_beep(250, 250, 100); // Beep to indicate end
		return 'l';
	}
	else if (rt <= side)  // Checks right buffer
	{
		SPKR_play_beep(250, 250, 100); // Beep to indicate end
		return 'r';
	}
	else if (ft <= front)  // Checks front buffer
	{
		SPKR_play_beep(250, 250, 100); // Beep to indicate end
		return 'f';
	}
	else
	{
		// Calculate very small random angle increment
		if(angle==1)
		{
			int angle = 21-randRange(1,40);
			rotateDeg(angle);  // Rotates
		}
		forward(move);              // Moves forward
		return 'w';
	}
}
Example #14
0
int doSyncReads(int fd,int blockSize,s64 fileSize,int count) {
	for(int i=0;i<count;i++) {
		s64 offset=randRange(0,fileSize/blockSize)*blockSize;
		checkError(pread(fd,bufferPool[0],blockSize,(off_t)offset));
	}
	return count;
}
Example #15
0
static void test_blit_speed(void)
{
    Uint32 clearColor = SDL_MapRGB(dest->format, 0, 0, 0);
    Uint32 iterations = 0;
    Uint32 elasped = 0;
    Uint32 end = 0;
    Uint32 now = 0;
    Uint32 last = 0;
    int testms = testSeconds * 1000;
    int wmax = (dest->w - src->w);
    int hmax = (dest->h - src->h);
    int isScreen = (SDL_GetVideoSurface() == dest);
    SDL_Event event;

    printf("Testing blit speed for %d seconds...\n", testSeconds);

    now = SDL_GetTicks();
    end = now + testms;

    do
    {
        /* pump the event queue occasionally to keep OS happy... */
        if (now - last > 1000)
        {
            last = now;
            while (SDL_PollEvent(&event)) { /* no-op. */ }
        }

        iterations++;
        elasped += blit(dest, src, randRange(0, wmax), randRange(0, hmax));
        if (isScreen)
        {
            SDL_Flip(dest);  /* show it! */
            SDL_FillRect(dest, NULL, clearColor); /* blank it for next time! */
        }

        now = SDL_GetTicks();
    } while (now < end);

    printf("Non-blitting crap accounted for %d percent of this run.\n",
            percent(testms - elasped, testms));

    printf("%d blits took %d ms (%d fps).\n",
            (int) iterations,
            (int) elasped,
            (int) (((float)iterations) / (((float)elasped) / 1000.0f)));
}
Example #16
0
void hvExplosionTemplate(Bullet *previous, Bullet *bullet, World *world, int n,
		int max, int rand) {
	bullet->x = (world->width / 2) + rand;
	bullet->y = world->height / 4;
	bullet->theta = wrapDegree(n * 10 + rand);
	bullet->velocity = randRange(6, 20) / 9.50 + ((double) world->level.level / 80);
	bullet->sFn = decreasingVelocity;
}
Example #17
0
glm::vec3 Mth::randInsideSphere(float radius) {
    float phi = randRange(0.0f, PI*2.0f);
    float costheta = randUnit();
    float u = rand01();

    float theta = acos(costheta);
    float r = radius * std::pow(u, 1.0f / 3.0f);
    return glm::vec3(sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta))*r;
}
Example #18
0
bool alex::ObjectBase::diffuse(const alex::Ray &inRay, const cv::Vec3d &intersection, const cv::Vec3d &normalVecN,
                               cv::Vec3d &color, alex::Ray &outRay) const {

  auto zAxis = normalVecN;
  auto yAxis = getAVerticalNVec(normalVecN);
  auto xAxis = yAxis.cross(zAxis);

  double cosTheta = randRange(0, 1);
  auto theta = acos(cosTheta);

  //double theta = randRange(0, M_PI / 2);
  double phi = randRange(0, M_PI * 2);

  auto direction = zAxis * sin(theta) + (yAxis * cos(phi) + xAxis * sin(phi)) * cos(theta);

  outRay = Ray(intersection + normalVecN * alex::Epsilon, direction);
  color = diffuseColor;
  return true;
}
Example #19
0
void JitterMoveEvent::setPositionLimits(const Vec4& posMin, const Vec4& posMax)
{
	for(U i = 0; i < 3; i++)
	{
		m_newPos[i] = randRange(posMin[i], posMax[i]);
	}

	m_newPos[3] = 0.0;
	m_newPos += m_originalPos;
}
Example #20
0
void horizontalTemplate(Bullet *previous, Bullet *bullet, World *world, int n,
		int max, int rand) {
	bullet->x = round(
			((double) world->width
					/ (max >= world->width ? world->width / 2 : max)) * n);
	bullet->y = randRange(2, 10);
	bullet->theta = 0; // 0 degree does down
	bullet->velocity =
			(previous == NULL) ? randVelocity(world) : previous->velocity;
	bullet->sFn = increasingVelocity;
}
// Returns a valid offset for the new patch to apply
Point RandomOffsetChooser::getNewOffset(bool *foundMask) const {

    int minX, maxX, minY, maxY;
    getBoundaries(*outputMask, &minX, &maxX, &minY, &maxY);

    if (maxX < 0 || maxY < 0) {
        *foundMask = false;
        return Point(randRange(0, outputMask->width()  - patch->width()  + 1),
                     randRange(0, outputMask->height() - patch->height() + 1));
    } else {
        *foundMask = true;

        int offX, offY;
        do {
            offX = randRange(max(0, minX - patch->width()  + 1), min(maxX, outputMask->width()  - patch->width()  + 1));
            offY = randRange(max(0, minY - patch->height() + 1), min(maxY, outputMask->height() - patch->height() + 1));
        } while (!checkOffset(offX, offY));

        return Point(offX, offY);
    }
}
Example #22
0
void initialisePickups(Pickup *_array)
{
  const int WIDTH=800;
  const int HEIGHT=600;

  // Populate Pickup array with randomised positions/types
  for(int i = 0; i < PICKUP_TOTAL; ++i)
  {
    // A hacky way of setting a 1/5 chance of creating a moving Pickup (knight)
    _array[i].canTravel = !(randRange(0, 4));

    if(_array[i].canTravel)
    {
      _array[i].pos.x = randRange(0, WIDTH - KNIGHT_SIZE);
      _array[i].pos.y = randRange(0, HEIGHT - KNIGHT_SIZE);

      _array[i].Anim.offset.x = 0;
      _array[i].Anim.offset.y = getRandomMovement();
      //Randomly choose a knight direction
    }
    else
    {
      _array[i].pos.x = randRange(0, WIDTH - PICKUP_SIZE);
      _array[i].pos.y = randRange(0, HEIGHT - PICKUP_SIZE);

      //Randomly choose a type of gem
      _array[i].Anim.type = randRange(BLUE, CRYSTAL);
    }

    _array[i].isVisible = true;
  }
}
Example #23
0
static
int
randRange(const Uint32 odds[], Uint32 count){
  Uint32 val = randRange((Uint32)0, 100);
  
  Uint32 i = 0;
  Uint32 sum = 0;
  while(sum <= val && i < count){
    sum += odds[i];
    i++;
  }
  return i - 1;
}
Example #24
0
void drawRock(point pos, unsigned short version, unsigned short size) {
	point myRock[ROCK_VERTICIES]; int i = 0;
	version %= ROCK_TYPES;
	for(i = 0; i < ROCK_VERTICIES; i++) {
		myRock[i] = makePoint(pos.x+size*rockShapes[version][i].x,
													pos.y+size*rockShapes[version][i].y);
	}
	if(getSetting() >= 1) {
		drawFilledPolygon(myRock, ROCK_VERTICIES, ROCK_SHADE);
	} else {
		drawPolygon(myRock, ROCK_VERTICIES, ROCK_SHADE+randRange(0,1));
	}
}
Example #25
0
char *inputString() {
  static char s[MAX_INPUT_STRING];
  char x[] = "reset";
  size_t n = sizeof(x) / sizeof(x[0]);
  size_t i;
  int len = randRange(MIN_INPUT_STRING, MAX_INPUT_STRING);

  for (i = 0; i < len; i++) {
    s[i] = randChar(x, n);
  }

  return s;
}
Example #26
0
void makeMats(){
  FILE *fp;
  int rowA;
  int colArowB;
  int colB;
  int x, y;

  srand(time(NULL));
  rowA = randRange(MIN, MAX);
  colArowB = randRange(MIN, MAX);
  colB = randRange(MIN, MAX);

  fp = fopen("./matA.txt", "w+");
  fprintf(fp, "%d\n%d\n", rowA, colArowB);
  for(x = 0; x < rowA; x++){
    for(y = 0; y < colArowB; y++){
      fprintf(fp, "%d", randRange(MIN, MAX));
      if(y < colArowB - 1){
        fprintf(fp, "%c", ' ');
      }
    }
    fprintf(fp, "%c", '\n');
  }
  fclose(fp);

  fp = fopen("./matB.txt", "w+");
  fprintf(fp, "%d\n%d\n", colArowB, colB);
  for(x = 0; x < colArowB; x++){
    for(y = 0; y < colB; y++){
      fprintf(fp, "%d", randRange(MIN, MAX));
      if(y < colB - 1){
	fprintf(fp, "%c", ' ');
      }
    }
    fprintf(fp, "%c", '\n');
  }
  fclose(fp);
}
Example #27
0
void deployBullet(World *world, BulletType type) {

	if (world->counter < world->interval) {
		world->counter++;
		return;
	} else {
		world->counter = 0;
		world->interval = randRange(0, (int) (50.0 / world->level.level));
	}

	if (world->level.ammo == 0) {
		// ammo depleted
		return;
	}

	int count = randRange(15, (int) world->width * (1.0 / 3.0));
	if (world->level.ammo < count) {
		count = world->level.ammo;
	}
	world->level.ammo -= count;
	int i;
	// gotta make space for our bullets :)
	Bullet *bullet = malloc(sizeof(Bullet) * count);
	int range = world->width / 2;
	int randDelta = randRange(-range, range);

	DeployTemplateFn templateFn = randomTemplate();

	for (i = 0; i < count; i++) {
		templateFn(i == 0 ? NULL : &bullet[i - 1], &bullet[i], world, i, count,
				randDelta);
		bullet[i].c = 'o';
		bullet[i].life = 0;
		bullet[i].recycled = false;
		bullet[i].type = type;
		appendList(&world->bullets, &bullet[i]);
	}
}
Example #28
0
void GameState::update()
{
	//spawn enemies
	spawnDelay += sfw::getDeltaTime();

	if (spawnDelay > spawnRate)
	{
		spawnDelay = 0;
		spawnRate *= .98f;
		spawnEnemy(randRange(BOUNDS_LEFT, BOUNDS_RIGHT), BOUNDS_TOP);
	}

	//updating
	player.update();
	for (int i = 0; i < bullets.size(); ++i)
		bullets[i].update();
	for (int i = 0; i < enemies.size(); ++i)
		enemies[i].update();

	//Collision
	//player v bullets/enemies
	for (int i = 0; i < bullets.size(); ++i)
		collides(player, bullets[i]);
	for (int i = 0; i < enemies.size(); ++i)
		collides(player, enemies[i]);

	//bullet v enemies
	for (int i = 0; i < enemies.size(); ++i)
		for (int j = 0; j < bullets.size(); ++j)
			collides(enemies[i], bullets[j]);

	for (int i = 0; i < bullets.size(); ++i)
		for (int j = 0; j < bullets.size(); ++j)
			collides(bullets[i], bullets[j]);

	if (appState == GAME)
	{
		if (!player.active)
		{
			std::fstream fout("scores.dat",std::ios_base::out | std::ios_base::app);
			fout << score << std::endl;
			fout.close();
			
			appState = VICTORY;
		}
		if (sfw::getKey('P'))
			appState = PAUSE;
	}
}
Example #29
0
//Object adding functions
void addRock(point rockPos, float dx, float dy, unsigned char rockSize) {
	int i;
	for(i = 0; i < MAX_ROCKS; i++) {
		if(gRocks[i].status == DEAD) {
			gRocks[i].x = rockPos.x;
			gRocks[i].y = rockPos.y;
			gRocks[i].dx = dx;
			gRocks[i].dy = dy;
			gRocks[i].status = ALIVE;
			gRocks[i].rockType = randRange(0, ROCK_TYPES-1);
			gRocks[i].rockSize = rockSize;
			return;
		}
	}
}
Example #30
0
void deployPlayerBullet(World *world) {

	if (world->player.dep) {
		world->player.dep = false;
	} else {
		return;
	}

	if (world->player.ammo > 0) {
		world->player.ammo--;
	} else {
		return;
	}
	//locate(1, 4);
	//printf("ACTUAL %d ammo:%ld\n", 6, world->level.ammo);
	int count = randRange(3, (int) world->width * (1.0 / 3.0));
	if (world->level.ammo < count) {
		count = world->level.ammo;
	}
	world->level.ammo -= count;
	int i;

	Bullet *bullet = malloc(sizeof(Bullet) * count);
	int range = world->width / 2;
	int randDelta = randRange(-range, range);

	for (i = 0; i < count; i++) {
		playerCircleTemplate(i == 0 ? NULL : &bullet[i - 1], &bullet[i], world,
				i, count, randDelta);
		bullet[i].c = 'o';
		bullet[i].life = 0;
		bullet[i].recycled = false;
		bullet[i].type = PLAYER_AMMO;
		appendList(&world->bullets, &bullet[i]);
	}
}