Пример #1
0
int test_tas(int y, int x, int position, unsigned ocean[DIM][DIM], c couleurs[DIM][DIM]){
    int changement = 0;
    if (ocean[y][x] >= 4){
        int div4 = ocean[y][x] / 4;
        ocean[y][x] = ocean[y][x]  % 4;
        ocean[y][x-1] += div4;
        ocean[y][x+1] += div4;
        ocean[y-1][x] += div4;
        ocean[y+1][x] += div4;
        
#ifdef DISPLAY
        coloring(y,x-1,1, ocean, couleurs);
        coloring(y,x+1,1, ocean, couleurs);
        coloring(y-1,x,1, ocean, couleurs);
        coloring(y+1,x,1, ocean, couleurs);
        
        coloring(y,x,1, ocean, couleurs);
#endif
        
        propager(y,x, position+1, ocean, couleurs);
        changement = 1;
        
        
    }
    
    return changement;
}
Пример #2
0
t_bunny_response	inaddr_connect(void *param)
{
  t_params		*params;

  params = param;
  coloring(params->background, 0x322B00);
  bunny_blit(&params->window->buffer,
	     &params->background->clipable, &params->origin);
  disp_elems(params, params->connect_buttons);
  params->connect_buttons->hover = 0;
  return (GO_ON);
}
Пример #3
0
int traiterProp(int y_d, int x_d, int y_f, int x_f, unsigned ocean[DIM][DIM], c couleurs[DIM][DIM]){
    int changement = 0;
    
    for (int y = y_d; y < y_f; y++)
    {
        for (int x = x_d; x < x_f ; x++){
            int move = test_tas(y,x, 0, ocean, couleurs);
#ifdef DISPLAY
            coloring(y,x-1,move, ocean, couleurs);
            coloring(y,x+1,move, ocean, couleurs);
            coloring(y-1,x,move, ocean, couleurs);
            coloring(y+1,x,move, ocean, couleurs);
            
            coloring(y,x,move, ocean, couleurs);
#endif
            
            if (move == 1){
                changement = 1;
            }
        }
        
    }
    return changement;
}
	// TODO : No shuffling, select random every time
	SyncColoringsRandomEnumerator::SyncColoringsRandomEnumerator(int verticesCount, int outDegree)
		: isFirst(true),
		  graph(nullptr),
		  syncChecker(verticesCount, outDegree),
		  random(random_device()()),
		  shuffleCnt(shuffleEvery) {

		colorings.reserve(GraphColoring::ColoringsCount(verticesCount, outDegree));
		GraphColoring coloring(verticesCount, outDegree);
		do {
			colorings.push_back({coloring.GetId(), coloring});
		}
		while (coloring.NextColoring());

		shuffle(colorings.begin(), colorings.end(), random);
		currentIt = colorings.begin();
		Current = currentIt->first;
	}
	SyncColoringsOptimalEnumerator::SyncColoringsOptimalEnumerator(int verticesCount, int outDegree)
		: n(verticesCount), k(outDegree),
		  graph(nullptr),
		  syncChecker(verticesCount, outDegree),
		  coloringsGraph(BuildColoringsGraph(verticesCount, outDegree)),
		  Current(0) {

		colorings.reserve(GraphColoring::ColoringsCount(verticesCount, outDegree));
		GraphColoring coloring(n, k);
		do {
			colorings.push_back(coloring);
		}
		while (coloring.NextColoring());

		bfsQueue.Resize(colorings.size());
		bfsDistance.resize(colorings.size());
		InitializeQueue();

	}
Пример #6
0
void	draw_fract(t_env *e)
{
	int			i;
	double		re;
	double		im;

	e->win_x = 0;
	while (e->win_x < WIN_WIDTH)
	{
		e->win_y = 0;
		while (e->win_y < WIN_HEIGHT)
		{
			set_env_values(e, &re, &im);
			i = do_iter(e, re, im);
			ft_putpix(e, e->win_x, e->win_y,
				coloring(i, e->new_r, e->new_i) * (i < e->max_i));
			e->win_y++;
		}
		e->win_x++;
	}
}
Пример #7
0
t_lst			*new_button(char *label, int x, int y,
				    t_bunny_response (*func)(void *, int))
{
  t_bunny_pixelarray	*bg;
  t_bunny_position	pos;
  t_lst			*button;

  button = malloc(sizeof(t_lst));
  button->next = NULL;
  button->text = label;
  button->pos.x = x;
  button->pos.y = y;
  button->action = func;
  button->hover = 0;
  bg = bunny_new_pixelarray(500, 70);
  coloring(bg, 0x322B00);
  parall(bg, 0xE3F6FD);
  button->background = bg;
  pos.x = 220;
  pos.y = 7;
  write_text(bg, label, &pos);
  return (button);
}