-
Notifications
You must be signed in to change notification settings - Fork 0
/
fillit.h
101 lines (78 loc) · 2.68 KB
/
fillit.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fillit.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kmira <kmira@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/22 18:38:58 by kmira #+# #+# */
/* Updated: 2019/05/16 20:30:20 by kmira ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FILLIT_H
# define FILLIT_H
# include "libft/libft.h"
# include "fillit_structs.h"
# include <fcntl.h>
# include <sys/types.h>
# include <sys/uio.h>
# include <unistd.h>
# include <stdint.h>
/*
** Top Section needs to be added to a place in libft.h
*/
# include <errno.h>
# define INVALID_FILE -1
/*
** This counts as two lines of code and is potentially dangerous/difficult to
** catch why an else statement might be expecting an expression.
** I would recommend making this a standalone function and just calling that.
*/
# ifndef EXIT
# define EXIT(error_msg) ft_puterror(error_msg)
# endif
# define ERROR()
/*
** ------------------------------END-------------------------------------
*/
# define MAX_BOARD_SIZE 16
# define MAX_TETRIMINO_PIECES 26
# define MAX_FILE_BYTES 546
# define PIECE_LEN 20
/*
** Found in file:
** input.c
*/
int begin_reading(int fd, t_tetrimino *tetrimino);
int input_sanitized(char *file_buff, int bytes_read, t_tetrimino *tetrim);
int piece_sanitized(char *piece_buffer, int bytes_remaining);
int isvalid_chars(char *buffer);
int isfully_connected(char *buffer);
/*
** Found in file:
** encoding.c
*/
void encode_piece(char *buffer, t_tetrimino *tetrimino, int piece_index);
/*
** Found in file:
** solver.c
*/
int count_pieces(t_tetrimino *tetrimino);
int fill_board_with(t_tetrimino *tetriminos);
/*
** Found in file:
** output.c
*/
void write_piece(t_tetrimino piece, char *board_str, int board_size);
void print_solution_of(t_tetrimino *tetriminos, int board_size);
/*
** Found in file:
** solving_utils.c
*/
void place_piece
(t_tetrimino *tetrimino, unsigned short *board, int *row, int *col);
void remove_piece
(t_tetrimino tetrimino, unsigned short *board, int *row, int *col);
int board_is_solved
(int *current_piece, t_tetrimino *tetrimino, int *row, int *col);
#endif