int key_release_hook(int keycode, t_mlx *mx) { if (keycode == ESCAPE) exit (0); if (keycode == ONE) mx->b ^= 1; if (keycode == TWO) mx->b ^= 2; if (keycode == THREE) mx->b ^= 4; if (keycode == FOUR) mx->b ^= 8; if (keycode == SCREEN) mx->screen = 0; if (keycode == TOP) mx->top = 0; if (keycode == BOTTOM) mx->bottom = 0; if (keycode == LEFT) mx->left = 0; if (keycode == RIGHT) mx->right = 0; if (keycode == ONE || keycode == TWO || keycode == THREE || keycode == FOUR) ft_display(mx, &mx->map, &mx->v); return (0); }
int main(int argc, char **argv) { int s; int n; int j; char **tab; char **grid; n = 0; j = 0; if (argc != 2) ft_error(0); else tab = ft_tab(argv[1]); while (j == 0) { grid = ft_grid(tab, n, &s); j = ft_resolution(tab, &grid, s, 0); n++; if (j == 0) ft_free(&grid, s); } ft_display(grid, s); return (0); }
static void ft_check_get_next_line(int i, t_connect *connect) { if (i <= 0) ft_display(connect->table); else (void)connect; }
int main(int ac, char **av) { char **tab; if (ac == 10) { tab = ft_tabcpy(av); ft_display(tab); ft_putchar('\n'); backtrack(tab, 0); ft_display(tab); } else ft_putstr("Erreur\n"); return (0); }
static int ft_top(t_infos *infos, int l) { int value; int tmp; value = (l - 1 < 0) ? 0 : l - 1; value = (value < 0) ? infos->nbr_args - 1 : value % infos->nbr_args; if (!infos->args[l].c.y && !infos->args[l].col && infos->start) { --infos->id_page; tmp = infos->start - infos->page[infos->id_page]; infos->start = infos->page[infos->id_page]; infos->lastid = value; ft_display(infos); infos->redisp = 1; infos->pos_col = (tmp / infos->size.ws_row) - 1; } else { if (infos->args[value].c.x > infos->args[l].c.x) ++infos->pos_col; else if (infos->args[value].c.x < infos->args[l].c.x) --infos->pos_col; } return (value); }
static int ft_bottom(t_infos *infos, int l) { int value; value = (l + 1 < infos->nbr_args) ? l + 1 : infos->nbr_args - 1; value = (value < 0) ? infos->nbr_args - 1 : value % infos->nbr_args; if (infos->args[l].c.y == infos->size.ws_row - 1 && infos->args[l].col + 1 == infos->column && !infos->end) { if (infos->id_page) infos->page[infos->id_page] = infos->start; ++infos->id_page; infos->start += infos->column * infos->size.ws_row; infos->lastid = value; ft_display(infos); infos->redisp = 1; infos->pos_col = 0; } else { if (infos->args[value].c.x > infos->args[l].c.x) ++infos->pos_col; else if (infos->args[value].c.x < infos->args[l].c.x) --infos->pos_col; } return (value); }
int ft_core(t_stack *stack_one, t_stack *stack_two, char *options) { int tmp[2]; char *sols; if (stack_one) { if ((tmp[0] = check_possibilities(stack_one, options, &sols)) != -1) return (tmp[0]); while (stack_one->next->next) { tmp[1] = ft_get_min(stack_one); tmp[0] = ft_direction(stack_one, tmp[1]) + (options[1] ? 10 : 0); ft_move(&stack_one, stack_two, tmp, &sols); ft_p(&stack_two, &stack_one, options[1] ? 1 : 0); if (options[1]) ft_print_stack(stack_one, stack_two); sols = ft_strjoin_free(sols, " pb"); } if (stack_one->number > stack_one->next->number) last(&stack_one, stack_two, options, &sols); ft_repush(&stack_two, &stack_one, &sols, options[1]); return (ft_display(sols, options, stack_one)); } return (0); }
int main(int argc, char **argv) { if (argc < 2) ft_display2(); if (argc == 2 && argv[1][0] == '-' && argv[1][1] == 'c' && argv[1][2] == '\0') illegal_truc(); else if (argc == 3 && argv[1][0] == '-' && argv[1][1] == 'c' && argv[1][2] == '\0' && error_nb(argv[2], "-c") != -10) bug_chelou(); else if (argc == 3) illegal(argv); else ft_display(argc, argv); return (0); }
void ft_init(t_tetris *tetris, int pcs) { int sqr_sze; char **map; sqr_sze = ft_bsq(pcs); if ((map = ft_createmap(sqr_sze)) == NULL) return ; while (ft_fill_map(tetris, map, sqr_sze, 0) == 0) { sqr_sze++; free(map); if ((map = ft_createmap(sqr_sze)) == NULL) return ; } ft_display(map, sqr_sze); }
int key_loop_hook(t_mlx *mx) { if (mx->screen || mx->top || mx->bottom || mx->right || mx->left) { if (mx->screen) ft_tofile(mx->data); if (mx->top) ft_top(&mx->v, &mx->map); if (mx->bottom) ft_bottom(&mx->v, &mx->map); if (mx->left) ft_left(&mx->v); if (mx->right) ft_right(&mx->v); ft_display(mx, &mx->map, &mx->v); } return (0); }
int main(int ac, char **av) { int port; int sock; char buf[1024]; if (ac != 3) usage(av[0]); port = ft_atoi(av[2]); if (ft_strcmp(av[1], "localhost") == 0) av[1] = "127.0.0.1"; if ((sock = create_client(av[1], port)) == -1) error_display("ERROR: sock()"); ft_bzero(buf, 1024); while (1) ft_display(buf, sock); close(sock); return (0); }
int main( int ac, char **av ) { DIR *ptr_dir; t_ls *ls; char option; ls = NULL; if (ft_check_params_1(ac, av) == -1) return (-1); ptr_dir = opendir("."); if (!ptr_dir) { perror("opendir"); return (-1); } ls = ft_init(ls, ptr_dir); option = av[1] ? av[1][1] : 'z'; if (ft_display(ls, option) == -1) return (-1); return (0); }
static int ft_jmp_left(t_infos *infos, int lid) { int value; int tmp; value = lid - infos->size.ws_row; if (infos->pos_col) --infos->pos_col; else if (infos->start) { --infos->id_page; tmp = infos->start - infos->page[infos->id_page]; infos->start = infos->page[infos->id_page]; infos->lastid = value; ft_display(infos); infos->redisp = 1; infos->pos_col = (tmp / infos->size.ws_row) - 1; } if (value < 0) value += infos->size.ws_row; return ((value < 0) ? infos->nbr_args - 1 : value % infos->nbr_args); }
static int ft_jmp_right(t_infos *infos, int lid) { int value; value = lid + infos->size.ws_row; if (value >= infos->nbr_args) value -= infos->size.ws_row; else if (!infos->end && infos->args[value].col == infos->column) { if (infos->id_page) infos->page[infos->id_page] = infos->start; ++infos->id_page; infos->start += infos->column * infos->size.ws_row; infos->lastid = value; ft_display(infos); infos->redisp = 1; infos->pos_col = 0; } else if (value < infos->nbr_args) ++infos->pos_col; return ((value < 0) ? infos->nbr_args - 1 : value % infos->nbr_args); }
int main(int ac, char **av) { t_coord **coord; t_varf v; (ac != 2) ? (ft_exit()) : (0); v.tab = NULL; v.file = ft_strnew(1); ((v.fd = open(av[1], O_RDONLY)) == -1) ? (ft_exit()) : (0); ft_check_tetri(v.fd); (close(v.fd) == -1) ? (ft_exit()) : (0); ((v.fd = open(av[1], O_RDONLY)) == -1) ? (ft_exit()) : (0); ft_errors(v.fd, &v.file); (close(v.fd) == -1) ? (ft_exit()) : (0); v.file = ft_letters(v.file); coord = ft_store(v.file); free(v.file); v.tab = ft_result(*coord, ft_nbr_blk(*coord)); free(coord); ft_display(v.tab); free(v.tab); return (0); }
void ft_condition(char a1c, char b1c, char a2c, char b2c) { while (a1c <= '9') { while (b1c <= '9') { while (a2c <= '9') { while (b2c <= '9') { ft_display(a1c, b1c, a2c, b2c); b2c++; } a2c++; b2c = '0'; } b1c++; a2c = '0'; } a1c++; b1c = '0'; } }