-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint_board.c
57 lines (51 loc) · 1.11 KB
/
print_board.c
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
//Declare struct here
struct solve_state
{
int board[10][9][9];
int views[9][4];
int N;
int x;
int y;
int z;
};
//This section is for headers and function prototypes
void ft_putchar(char c);
int get_cell_value(struct solve_state current, int x, int y);
void print_board(struct solve_state current) {
int x;
int y;
y = 0;
while (y < current.N) // goes through every row
{
x = 0;
ft_putchar(get_cell_value(current, x, y) + '0'); //Prints the first digit of the row
x++;
while (x < current.N)
{
ft_putchar(' ');
ft_putchar(get_cell_value(current, x, y) + '0');
x++;
}
ft_putchar('\n');
y++;
}
}
/*
int get_cell_value(struct solve_state current, int x, int y)
{
int i;
i = 0;
if (current.board[9][y][x] == 1) {
if (current.board[0][y][x] == 1)
return (1);
while (current.board[i][y][x] == 0)
i++;
return (current.board[i][y][x]);
}
return (0);
}
void ft_putchar(char c)
{
write(1, &c, sizeof(c));
}
*/