int ft_printf(char *format, ...) { char *tmp; t_precis nb; t_flag flag; va_list ap; int len; va_start(ap, format); tmp = format; len = 0; nb.j = -1; while (nb.j++ < (int)ft_strlen(format) - 1) { if (tmp[nb.j] == '%' && check_double_modulo(format, &nb) == 1) modul(&nb, &flag, format, &len); else if (tmp[nb.j] == '%' && tmp[nb.j + 1] != '\0') { modul_alo(&nb, &flag, format); len += check_convers(&flag, ap, format, &nb); } else if ((tmp[nb.j] != '%' && ft_strlen(format) != 1) || (tmp[nb.j] != '%' && ft_strlen(format) == 1)) put_char(tmp[nb.j], &len); } va_end(ap); return (len); }
int rank(int k, int l,int p){ float m = modul(k,l); int r=rand()%100; int i,h,res; if(hardness[p]>=0){ h=hardness[p]; i=1; }else{ h=-hardness[p]; i=0; } if(10*r<(10-h)*(procenty[0]+m*odchyly[0])+h*(ext[i][0])){ marks[0][p]++; return 4; }else if(10*r<(10-h)*(procenty[1]+m*odchyly[1])+h*(ext[i][1])){ marks[1][p]++; return 6; }else if(10*r<(10-h)*(procenty[2]+m*odchyly[2])+h*(ext[i][2])){ marks[2][p]++; return 7; }else if(10*r<(10-h)*(procenty[3]+m*odchyly[3])+h*(ext[i][3])){ marks[3][p]++; return 8; }else if(10*r<(10-h)*(procenty[4]+m*odchyly[4])+h*(ext[i][4])){ marks[4][p]++; return 9; }else if(10*r<(10-h)*(procenty[5]+m*odchyly[5])+h*(ext[i][5])){ marks[5][p]++; return 10; }else{ marks[6][p]++; return 11; } }
int choose(int k, int l){ int r=rand()%100; if(r<wybieralnosc+wyb_odch*modul(k,l)){ return 1; }else{ return 0; } }
int compute_Julia(Input in, int i, int j) { complex_t c = new_complex(in.julia_param1, in.julia_param2); int step = 0; complex_t z = new_complex(in.x_min + j * in.rezolutie, in.y_min + i * in.rezolutie); while(modul(z) < 2 && step < in.max_steps) { z = add(mult(z, z), c); step++; } return step % NUM_COLORS; }
int compute_Mandelbrot(Input in, int i, int j) { complex_t z = new_zero_complex(); complex_t c = new_complex(in.x_min + j * in.rezolutie, in.y_min + i * in.rezolutie); int step = 0; while(modul(z) < 2 && step < in.max_steps) { z = add(mult(z, z), c); step++; } return step % NUM_COLORS; }
void LiczbaZespolona::wyswietl() { std::cout<<re<<"+"<<im<<"i ("<<modul()<<")"<<std::endl; }