42 lines
768 B
Text
42 lines
768 B
Text
|
#include<stdlib.h>
|
||
|
#include<stdio.h>
|
||
|
#include<string.h>
|
||
|
#include<stdbool.h>
|
||
|
|
||
|
int xmas_detector(char *x)
|
||
|
{
|
||
|
int directions[8][2] = {{-1, -1}, {0, -1}, {1, -1}, {1, 0},
|
||
|
{1, 1}, {0, 1}, {-1, 1}, {-1, 0}};
|
||
|
for (int i = 0; i < 8; i++) {
|
||
|
for (int j = 0; j < 3; j++) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int main ()
|
||
|
{
|
||
|
// make 2d array
|
||
|
FILE *input = fopen("./inputDemo", "r");
|
||
|
int width = 0;
|
||
|
int height = 1;
|
||
|
while (fgetc(input) != '\n') width++;
|
||
|
for (char c = fgetc(input); c != EOF; c = fgetc(input)) {
|
||
|
if (c == '\n')
|
||
|
height++;
|
||
|
}
|
||
|
printf("%d\n%d\n", width, height);
|
||
|
|
||
|
char **grid = malloc(width);
|
||
|
grid[0] = malloc(width * height);
|
||
|
for (int i = 1; i < width; i++) {
|
||
|
grid[i] = grid[0] + i * height;
|
||
|
}
|
||
|
|
||
|
grid[0][2] = '5';
|
||
|
|
||
|
// find x
|
||
|
//
|
||
|
// confirm mas in all 8 directions
|
||
|
}
|