-
Notifications
You must be signed in to change notification settings - Fork 0
/
filler.h
executable file
·106 lines (94 loc) · 3.36 KB
/
filler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* filler.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ioleksiu <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/05/05 13:24:25 by ioleksiu #+# #+# */
/* Updated: 2017/05/08 15:53:19 by ioleksiu ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FILLER_H
# define FILLER_H
# define BUFF_SIZE 1
# include <fcntl.h>
# include <ctype.h>
# include <unistd.h>
# include <stdlib.h>
# include <string.h>
typedef struct s_filler
{
char my_p;
char opp_p;
int size_map_x;
int size_map_y;
int size_figure_x;
int size_figure_y;
char **map;
char **figure;
int xy_distance[2];
int xy_cord_send[2];
int can_place_figure;
int left_border_touched;
int right_border_touched;
int i_am_up;
} t_filler;
typedef struct s_list
{
int x;
int y;
struct s_list *next;
} t_list;
typedef struct s_get
{
char *rest;
int fd;
struct s_get *next;
} t_get;
void figure_size(t_filler *f);
void memory_allocate_figure(t_filler *f);
void fill_figure(t_filler *f);
void map_size(t_filler *f);
void memory_allocate_map(t_filler *f);
void fill_map(t_filler *f);
void find_coordinates(t_filler *f);
int can_place_figure(int x, int y, t_filler *f);
void send_cord_xy(t_filler *f);
int is_the_closest(t_filler *f, int x_distance, int y_distance);
void find_the_closest_xy(t_filler *f, t_list *player,
t_list *other_p);
void choose_players(t_filler *f);
int get_next_line(const int fd, char **line);
int ft_one(int i, char **save, char **line, int a);
char *ft_strchr(const char *s, int c);
size_t ft_strlen(const char *str);
char *ft_strjoin(char const *s1, char const *s2);
char *ft_strdup(const char *s1);
void ft_putnbr_fd(int n, int fd);
char *ft_strsub(char const *s, unsigned int start, size_t len);
void ft_putstr_fd(char const *s, int fd);
void ft_putchar_fd(char s, int fd);
int ft_atoi(const char *str);
void ft_bzero(void *s, size_t n);
int ft_isdigit(int c);
char *ft_strstr(const char *big, const char *little);
int ft_tolower(int c);
char *ft_strnew(size_t size);
char *ft_strncpy(char *dst, const char *src, size_t len);
t_list *lst_create(int x, int y);
void lst_add(t_list *f, int x, int y);
void choose_the_right_algorithm(t_filler *f, t_list *player,
t_list *other_p);
int right_border_touched(t_filler *f);
int left_border_touched(t_filler *f);
void are_borders_touched(t_filler *f);
void go_to_the_right_border(t_filler *f, t_list *player,
t_list *other_p);
int closest_to_the_right(t_filler *f, int x_distance,
int y_distance, int y);
void go_to_the_left_border(t_filler *f, t_list *player,
t_list *other_p);
int closest_to_the_left(t_filler *f, int x_distance,
int y_distance, int y);
#endif