Esempio n. 1
0
File: solver.c Progetto: floklein/42
void	solver(t_tetri *tetri, t_square **sq, int tetri_nb)
{
	init_square(sq, tetri_nb);
	clear_positions(tetri, tetri_nb);
	while (!insert_tetri(tetri, 0, *sq, tetri_nb))
	{
		clear_positions(tetri, tetri_nb);
		(*sq)->x_max++;
		(*sq)->y_max++;
	}
}
Esempio n. 2
0
OneStim *NewSquare(Stimulus *st,Substim *sst)
{
    OneStim *gb;
    
    st->pos.size[0] = 250;
    st->pos.size[1] = 10;
    st->pos.size[0] = 250;
    st->pos.size[1] = 10;
    FreeStimulus(sst);
    if(sst->ptr == NULL)
        sst->ptr = (OneStim *)malloc(sizeof(OneStim));
    gb = sst->ptr; 
    init_square(st, sst);
    st->type = STIM_SQUARE;
    sst->type = STIM_SQUARE;
    return(gb);
}
Esempio n. 3
0
int main(int argc, char** argv) {

    struct Square square;
    struct Circle circle;
    struct Triangle triangle;

    init_square(&square, 2);
    init_circle(&circle, 4);
    init_triangle(&triangle, 3, 4, 5);

    struct Shape * shapes[3];
    shapes[0] = (struct Shape *) □
    shapes[1] = (struct Shape *) &circle;
    shapes[2] = (struct Shape *) ▵

    int i;
    for (i = 0; i < 3; ++i) {
        (*shapes[i]).print();
        printf("area: %f\n", (*shapes[i]).area(shapes[i]));
        printf("perimeter: %f\n\n", (*shapes[i]).perimeter(shapes[i]));
    }
    return (EXIT_SUCCESS);
}