-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewtable.c
71 lines (68 loc) · 1.72 KB
/
viewtable.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* viewtable.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cosney <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/24 03:35:10 by cosney #+# #+# */
/* Updated: 2020/04/24 22:55:17 by cosney ### ########.fr */
/* */
/* ************************************************************************** */
void view_up(char **argv, char board[][9], int k, int c, int i)
{
while (i < (4 * k))
{
board[k + 1][c] = argv[1][i];
if (board[k + 1][c] == '1')
board[k][c] = k + '0';
i = i + 2;
c++;
}
c = 1;
while (i < (6 * k))
{
board[c][0] = argv[1][i];
if (board[c][0] == '1')
board[c][1] = k + '0';
i = i + 2;
c++;
}
c = 1;
while (i < (8 * k))
{
board[c][k + 1] = argv[1][i];
if (board[c][k + 1] == '1')
board[c][k] = k + '0';
i = i + 2;
c++;
}
}
void viewtable(char **argv, char board[][9], int k)
{
int i;
int c;
i = 1;
while (i < (k + 1))
{
c = 1;
while (c < (k + 1))
{
board[i][c] = '0';
c++;
}
i++;
}
i = 0;
c = 1;
while (i < (2 * k))
{
board[0][c] = argv[1][i];
if (board[0][c] == '1')
board[1][c] = k + '0';
i = i + 2;
c++;
}
c = 1;
view_up(argv, board, k, c, i);
}