summaryrefslogtreecommitdiff
path: root/Advent-of-Code-2021/AOC-3
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-07-31 11:55:45 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-07-31 11:55:45 +0300
commit48966f12832ac97228132e56fb3159099f3e466e (patch)
tree9cc37aab6d00230787e19b68127abd2b818068ef /Advent-of-Code-2021/AOC-3
parentaec1c07260257ba7c28eff53f422ddb7daaf316a (diff)
cleanup
Diffstat (limited to 'Advent-of-Code-2021/AOC-3')
-rwxr-xr-xAdvent-of-Code-2021/AOC-3/aoc-3bin16648 -> 0 bytes
-rw-r--r--Advent-of-Code-2021/AOC-3/aoc-3.c~84
-rw-r--r--Advent-of-Code-2021/AOC-3/input.txt~0
-rw-r--r--Advent-of-Code-2021/AOC-3/main.c (renamed from Advent-of-Code-2021/AOC-3/aoc-3.c)0
-rw-r--r--Advent-of-Code-2021/AOC-3/sample.txt~0
5 files changed, 0 insertions, 84 deletions
diff --git a/Advent-of-Code-2021/AOC-3/aoc-3 b/Advent-of-Code-2021/AOC-3/aoc-3
deleted file mode 100755
index d163e8c..0000000
--- a/Advent-of-Code-2021/AOC-3/aoc-3
+++ /dev/null
Binary files differ
diff --git a/Advent-of-Code-2021/AOC-3/aoc-3.c~ b/Advent-of-Code-2021/AOC-3/aoc-3.c~
deleted file mode 100644
index 936402f..0000000
--- a/Advent-of-Code-2021/AOC-3/aoc-3.c~
+++ /dev/null
@@ -1,84 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <stdint.h>
-
-#define N 5
-#define INP_COUNT 12
-
-int table[N];
-
-void ParseInput(char *filepath)
-{
- char ch;
- FILE *fp;
- fp = fopen(filepath, "r");
-
- if(fp == NULL)
- {
- fprintf(stderr, "ERROR: something with file idk what fuck you");
- exit(EXIT_FAILURE);
- }
-
- int i = 0;
- while((ch = fgetc(fp)) != EOF)
- {
- if(ch == '\n') { i = 0; continue; }
-
- if(ch == '1')
- table[i] += 1;
-
- i += 1;
- }
-}
-
-void PrintTable()
-{
- for(int i=0; i<N; i++)
- {
- printf("bitplace %d: %d\n", i+1, table[i]);
- }
-}
-
-int PartOne()
-{
- int gamma_val = 0;
- for(int i=0; i<N; i++)
- {
- assert(table[i] != (INP_COUNT/2));
-
- if(table[i] > (INP_COUNT/2))
- {
- gamma_val = gamma_val | (1 << (N-1-i));
- }
- }
-
- int epsilon_val = gamma_val;
- for(int i=0; i<N; i++)
- {
- epsilon_val = epsilon_val ^ (1 << i);
- }
-
- int result = gamma_val * epsilon_val;
- return result;
-}
-
-int PartTwo()
-{
-
-
- int result = 0;
- return result;
-}
-
-int main(void)
-{
- memset(table, 0, sizeof(int)*N);
- ParseInput("sample.txt");
-
- PrintTable();
- printf("Part 1-RESULT: %d\n", PartOne());
-
- return 0;
-}
diff --git a/Advent-of-Code-2021/AOC-3/input.txt~ b/Advent-of-Code-2021/AOC-3/input.txt~
deleted file mode 100644
index e69de29..0000000
--- a/Advent-of-Code-2021/AOC-3/input.txt~
+++ /dev/null
diff --git a/Advent-of-Code-2021/AOC-3/aoc-3.c b/Advent-of-Code-2021/AOC-3/main.c
index 51cab24..51cab24 100644
--- a/Advent-of-Code-2021/AOC-3/aoc-3.c
+++ b/Advent-of-Code-2021/AOC-3/main.c
diff --git a/Advent-of-Code-2021/AOC-3/sample.txt~ b/Advent-of-Code-2021/AOC-3/sample.txt~
deleted file mode 100644
index e69de29..0000000
--- a/Advent-of-Code-2021/AOC-3/sample.txt~
+++ /dev/null