Ejemplo n.º 1
0
void place_rand(Board b) {
    PointList pl = open_spaces(b);
    Point p = pl_rand(pl);
    if (p == NULL) {
        fprintf(stderr, "Number not placed, board is full.\n");
        return;
    }
    place(b, p->r, p->c, two_or_four());
    pl_free(pl);
}
Ejemplo n.º 2
0
void		new_rand(t_tab *e)
{
	int x;
	int y;

	x = 1;
	y = 1;
	x = rand_pos(x);
	y = rand_pos(y);
	if (e->grid[x][y] == 0)
	{
		e->grid[x][y] = two_or_four();
		return ;
	}
	while (e->grid[x][y] != 0)
	{
		x = rand_pos(x);
		y = rand_pos(y);
	}
	e->grid[x][y] = two_or_four();
}