summaryrefslogtreecommitdiff
path: root/rush/max_test.c
blob: 057780db0183412d84ad58535858a0cc1fddca3e (plain)
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#include <unistd.h>

void	change_to_max(int x[4], int l, int r)
{
	int i;
	i = 0;
	while (i < 4)
		{
			if (i >= (l - 1) && i <= (4 - r))
				x[i] = 4;
			i++;
		}
}

void	ft_putchar(char c)
{
	write(1, &c ,1);
}

int	main(void)
{
	int	str[16] = {3, 3, 1, 2, 1, 2, 2, 3, 2, 3, 2, 1, 2, 1, 2, 3};
	
	int matrix[4][4] = {{0}};

	int	a;
	int	b;
	int	c;
	int	d;
	int	e;
	int f;
	int g;
	int h;

	a = 0;
	b = 1;
	c = 2;
	d = 3;
	e = 12;
	f = 5;
	h = 4;

	g = 8;

	// while (a < 4)
	// {
	// 	change_to_max(matrix[a], str[g], str[e]);
	// 	g++;
	// 	e++;
	// 	a++;
	// }

// int x;
// int	y;
// x = 0;
// y = 0;
{
	int x;
	x = 0;
	while (x < 4)
	{
		int	y;
		y = 0;
		while (y < 4)
		{
			if (y >= (str[a] - 1) && y <= (4 - str[h]))
				change_to_max2(&matrix[y][x]);
				y++;
		}
		x++;
	}
}


// while (b < 4)
// 	{
// 		if (b >= (d - 1) && b <= (4 - c))
// 			change_to_max2(&matrix[b][0]);
// 			b++;
// 	}

// while (c < 4)
// 	{
// 		if (c >= (b - 1) && c <= (4 - c))
// 			change_to_max2(&matrix[c][0]);
// 			c++;
// 	}

// while (a < 4)
// 	{
// 		if (d >= (c - 1) && d <= (4 - d))
// 			change_to_max2(&matrix[a][0]);
// 			d++;
// 	}
	
	int	i;
	int	j;

	i = 0;
	while (i <= 3)
	{
		j = 0;
		while (j <= 3)
		{
			ft_putchar(matrix[i][j] + '0');
			j++;
		}
		ft_putchar(0x0a);
		i++;
	}
}

	int x;
		x = 0;
		while (x < 4)
		{
			int	y;
			y = 0;
			while (y < 4)
			{
				if (y >= (str[a] - 1) && y <= (4 - str[b]))
					change_to_4(&matrix[y][x]);
					y++;
					a++;
					b++;
			}
			x++;
		}
}