summaryrefslogtreecommitdiff
path: root/rush/max_search_x.c
diff options
context:
space:
mode:
Diffstat (limited to 'rush/max_search_x.c')
-rw-r--r--rush/max_search_x.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/rush/max_search_x.c b/rush/max_search_x.c
new file mode 100644
index 0000000..244fb2d
--- /dev/null
+++ b/rush/max_search_x.c
@@ -0,0 +1,63 @@
+#include <unistd.h>
+void change_to_max(int x[4], int left, int right)
+{
+ int i;
+ i = 0;
+ while (i < 4)
+ {
+ if (left == 1)
+ x[0] = 4;
+ else if (right == 1)
+ x[3] = 4;
+ else if (i >= (left - 1) && i <= (4 - right))
+ x[i] = 4;
+ i++;
+ }
+}
+
+void ft_putchar(char c)
+{
+ write(1, &c ,1);
+}
+
+int main(void)
+{
+ int matrix[4][4] = {{0}};
+
+ int str[16] = {3, 3, 1, 2, 1, 2, 2, 3, 2, 3, 2, 1, 2, 1, 2, 3};
+
+ int a;
+ int e;
+ int g;
+
+ a = 0;
+ e = 12;
+ g = 8;
+
+ while (a < 4)
+ {
+ change_to_max(matrix[a], str[g], str[e]);
+ g++;
+ e++;
+ a++;
+ }
+
+ 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 matrix2[4][4] = {{0}};
+
+} \ No newline at end of file