summaryrefslogtreecommitdiff
path: root/2022
diff options
context:
space:
mode:
authornekineki <nekineki@nekineki.net>2022-12-11 14:47:27 +0100
committernekineki <nekineki@nekineki.net>2022-12-11 14:50:32 +0100
commitfe75c10e350743a1c078f065d69556fecf825ca5 (patch)
tree956556a564c9329346dc9d8b1535dc5e365f3d55 /2022
parenta74d2dc54aef546664bcc8c81eb8e01a93e94391 (diff)
move files around, update paths
Diffstat (limited to '2022')
-rwxr-xr-x2022/day01.py (renamed from 2022/day1/day1.py)2
-rwxr-xr-x2022/day02.py (renamed from 2022/day2/day2.py)4
-rwxr-xr-x2022/day03.py (renamed from 2022/day3/day3.py)6
-rwxr-xr-x2022/day04-oneline.py (renamed from 2022/day4/oneline.py)10
-rwxr-xr-x2022/day04.py (renamed from 2022/day4/asd.py)4
-rwxr-xr-x2022/day05-oneline.py (renamed from 2022/day5/oneline.py)4
-rwxr-xr-x2022/day05.py (renamed from 2022/day5/asd.py)4
-rw-r--r--2022/day06.c (renamed from 2022/day6/day6.c)6
-rwxr-xr-x2022/day06.py (renamed from 2022/day6/asd.py)4
-rwxr-xr-x2022/day07.py (renamed from 2022/day7/asd.py)4
-rw-r--r--2022/day08.c (renamed from 2022/day8/day8.c)6
-rwxr-xr-x2022/day08.py (renamed from 2022/day8/asd.py)4
-rwxr-xr-x2022/day09.py (renamed from 2022/day9/asd.py)6
-rwxr-xr-x2022/day10.py (renamed from 2022/day10/asd.py)4
-rwxr-xr-x2022/day11.py (renamed from 2022/day11/asd.py)4
-rw-r--r--2022/in/day01.pzl (renamed from 2022/day1/input.txt)0
-rw-r--r--2022/in/day01.ref (renamed from 2022/day1/input_test.txt)0
-rw-r--r--2022/in/day02.pzl (renamed from 2022/day2/input.txt)0
-rw-r--r--2022/in/day02.ref (renamed from 2022/day2/input_test.txt)0
-rw-r--r--2022/in/day03.pzl (renamed from 2022/day3/input.txt)0
-rw-r--r--2022/in/day03.ref (renamed from 2022/day3/input_test.txt)0
-rw-r--r--2022/in/day04.pzl (renamed from 2022/day4/pzl.txt)0
-rw-r--r--2022/in/day04.ref (renamed from 2022/day4/ref.txt)0
-rw-r--r--2022/in/day05.pzl (renamed from 2022/day5/pzl.txt)0
-rw-r--r--2022/in/day05.ref (renamed from 2022/day5/ref.txt)0
-rw-r--r--2022/in/day05_mod.pzl (renamed from 2022/day5/pzl_mod.txt)0
-rw-r--r--2022/in/day05_mod.ref (renamed from 2022/day5/ref_mod.txt)0
-rw-r--r--2022/in/day06.pzl (renamed from 2022/day6/pzl.txt)0
-rw-r--r--2022/in/day06.ref (renamed from 2022/day6/ref.txt)0
-rw-r--r--2022/in/day07.pzl (renamed from 2022/day7/pzl.txt)0
-rw-r--r--2022/in/day07.ref (renamed from 2022/day7/ref.txt)0
-rw-r--r--2022/in/day08.pzl (renamed from 2022/day8/pzl.txt)0
-rw-r--r--2022/in/day08.ref (renamed from 2022/day8/ref.txt)0
-rw-r--r--2022/in/day09.pzl (renamed from 2022/day9/pzl.txt)0
-rw-r--r--2022/in/day09.ref (renamed from 2022/day9/ref.txt)0
-rw-r--r--2022/in/day09_2.ref (renamed from 2022/day9/ref2.txt)0
-rw-r--r--2022/in/day10.pzl (renamed from 2022/day10/pzl.txt)0
-rw-r--r--2022/in/day10.ref (renamed from 2022/day10/ref.txt)0
-rw-r--r--2022/in/day11.pzl (renamed from 2022/day11/pzl.txt)0
-rw-r--r--2022/in/day11.ref (renamed from 2022/day11/ref.txt)0
40 files changed, 35 insertions, 37 deletions
diff --git a/2022/day1/day1.py b/2022/day01.py
index cf2ca85..3ae9953 100755
--- a/2022/day1/day1.py
+++ b/2022/day01.py
@@ -2,7 +2,7 @@
arr = []
s = 0
-with open("input.txt") as f:
+with open("in/day01.pzl") as f:
for line in f:
line = line.strip()
if line == '':
diff --git a/2022/day2/day2.py b/2022/day02.py
index 727bb31..b499db3 100755
--- a/2022/day2/day2.py
+++ b/2022/day02.py
@@ -6,8 +6,8 @@ import time
score1 = 0
score2 = 0
-# filename = "input_test.txt"
-filename = "input.txt"
+# filename = "in/day02.ref"
+filename = "in/day02.pzl"
with open(filename) as f:
for line in f:
line = line.strip()
diff --git a/2022/day3/day3.py b/2022/day03.py
index 2e08c21..22a79be 100755
--- a/2022/day3/day3.py
+++ b/2022/day03.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
-# filename = "input_test.txt"
-filename = "input.txt"
+# filename = "in/day03.ref"
+filename = "in/day03.pzl"
res1 = 0
with open(filename) as f:
for line in f:
@@ -29,8 +29,6 @@ with open(filename) as f:
res1 += add
break
-filename = "input_test.txt"
-# filename = "input.txt"
res2 = 0
with open(filename) as f:
for line in f:
diff --git a/2022/day4/oneline.py b/2022/day04-oneline.py
index 7311461..1d5ce6e 100755
--- a/2022/day4/oneline.py
+++ b/2022/day04-oneline.py
@@ -3,17 +3,17 @@
import numpy as np
from functools import reduce
-# filename = "ref.txt"
-filename = "pzl.txt"
+# filename = "in/day04.ref"
+filename = "in/day04.pzl"
res1 = 0
res2 = 0
-res1 = sum([1 for (ps,pe),(ds,de) in [[[int(n) for n in two.split('-')] for two in line.strip().split(',')] for line in open("pzl.txt")] if (ps<=ds and pe>=de)or(ps>=ds and pe<=de)])
+res1 = sum([1 for (ps,pe),(ds,de) in [[[int(n) for n in two.split('-')] for two in line.strip().split(',')] for line in open(filename)] if (ps<=ds and pe>=de)or(ps>=ds and pe<=de)])
print('res1:', res1)
-res1 = sum([1 for a,b in [np.array([line.strip().split(",")[0].split("-"), line.strip().split(",")[1].split("-")], dtype = int) for line in open("pzl.txt")] if reduce(lambda a,b:a*b,np.sign(b-a)) <= 0])
+res1 = sum([1 for a,b in [np.array([line.strip().split(",")[0].split("-"), line.strip().split(",")[1].split("-")], dtype = int) for line in open(filename)] if reduce(lambda a,b:a*b,np.sign(b-a)) <= 0])
print('res1:', res1)
-res2 = sum([1 for (ps,pe),(ds,de) in [[[int(n) for n in two.split('-')] for two in line.strip().split(',')] for line in open("pzl.txt")] if (ds<=pe<=de)or(ps<=de<=pe)])
+res2 = sum([1 for (ps,pe),(ds,de) in [[[int(n) for n in two.split('-')] for two in line.strip().split(',')] for line in open(filename)] if (ds<=pe<=de)or(ps<=de<=pe)])
print('res2:', res2)
diff --git a/2022/day4/asd.py b/2022/day04.py
index 7989e3e..0eee8f9 100755
--- a/2022/day4/asd.py
+++ b/2022/day04.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
-# filename = "ref.txt"
-filename = "pzl.txt"
+# filename = "in/day04.ref"
+filename = "in/day04.pzl"
res1 = 0
res2 = 0
with open(filename) as f:
diff --git a/2022/day5/oneline.py b/2022/day05-oneline.py
index 736492a..4ece069 100755
--- a/2022/day5/oneline.py
+++ b/2022/day05-oneline.py
@@ -3,8 +3,8 @@
from re import findall
from functools import reduce
-# filename = "ref.txt"
-filename = "pzl.txt"
+# filename = "in/day05.ref"
+filename = "in/day05.pzl"
m = [ [i for i in line.rstrip('\n')[1::4] ] for line in open(filename) if line.find('[') != -1]
# print('m:', m)
diff --git a/2022/day5/asd.py b/2022/day05.py
index 8fc94fa..b93cc78 100755
--- a/2022/day5/asd.py
+++ b/2022/day05.py
@@ -2,8 +2,8 @@
from functools import reduce
-# filename = "ref_mod.txt"
-filename = "pzl_mod.txt"
+# filename = "in/day05_mod.ref"
+filename = "in/day05_mod.pzl"
res1 = ''
res2 = ''
diff --git a/2022/day6/day6.c b/2022/day06.c
index 13d5c04..5e79b72 100644
--- a/2022/day6/day6.c
+++ b/2022/day06.c
@@ -3,10 +3,10 @@
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
-#include "../util.h"
+#include "util.h"
-// char filename[] = "ref.txt";
-char filename[] = "pzl.txt";
+// char filename[] = "in/day06.ref";
+char filename[] = "in/day06.pzl";
#define BUF_LEN 10000
u8 buf[BUF_LEN];
diff --git a/2022/day6/asd.py b/2022/day06.py
index c998af3..5a107df 100755
--- a/2022/day6/asd.py
+++ b/2022/day06.py
@@ -6,8 +6,8 @@ from re import findall
from copy import deepcopy
-# filename = "ref.txt"
-filename = "pzl.txt"
+# filename = "in/day06.ref"
+filename = "in/day06.pzl"
res1 = 0
res2 = 0
diff --git a/2022/day7/asd.py b/2022/day07.py
index 18a2e0e..7e3f593 100755
--- a/2022/day7/asd.py
+++ b/2022/day07.py
@@ -6,8 +6,8 @@ from re import findall
from copy import deepcopy
import sys
-# filename = "ref.txt"
-filename = "pzl.txt"
+# filename = "in/day07.ref"
+filename = "in/day07.pzl"
data = open(filename).read()
lines = [line for line in data.rstrip('\n').split('\n')]
diff --git a/2022/day8/day8.c b/2022/day08.c
index f59322e..e49e660 100644
--- a/2022/day8/day8.c
+++ b/2022/day08.c
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
-#include "../util.h"
+#include "util.h"
s32 reduce(s32 (*f)(s32 x, s32 y), s32 arr[], s32 len)
{
@@ -46,8 +46,8 @@ char *goto_char_in_string(char c, char *s)
#define PP(arr, y,x) *(*(arr+y)+x)
-// char filename[] = "ref.txt";
-char filename[] = "pzl.txt";
+// char filename[] = "in/day08.ref";
+char filename[] = "in/day08.pzl";
#define BUF_LEN 10000
char file_buf[BUF_LEN];
diff --git a/2022/day8/asd.py b/2022/day08.py
index c9a7209..4182d69 100755
--- a/2022/day8/asd.py
+++ b/2022/day08.py
@@ -6,8 +6,8 @@ from re import findall
from copy import deepcopy
import sys
-# filename = "ref.txt"
-filename = "pzl.txt"
+# filename = "in/day08.ref"
+filename = "in/day08.pzl"
data = open(filename).read().rstrip('\n')
lines = [line for line in data.split('\n')]
diff --git a/2022/day9/asd.py b/2022/day09.py
index 5a1d94a..59bdf04 100755
--- a/2022/day9/asd.py
+++ b/2022/day09.py
@@ -8,9 +8,9 @@ import sys
import time
animate = False
-# filename = "ref.txt"
-# filename = "ref2.txt"
-filename = "pzl.txt"
+# filename = "in/day09.ref"
+# filename = "in/day09_2.ref"
+filename = "in/day09.pzl"
data = open(filename).read()
lines = [line for line in data.rstrip('\n').split('\n')]
diff --git a/2022/day10/asd.py b/2022/day10.py
index 7281026..feb0034 100755
--- a/2022/day10/asd.py
+++ b/2022/day10.py
@@ -6,8 +6,8 @@ from re import findall
from copy import deepcopy
import sys
-# filename = "ref.txt"
-filename = "pzl.txt"
+# filename = "in/day10.ref"
+filename = "in/day10.pzl"
data = open(filename).read()
lines = [line for line in data.rstrip('\n').split('\n')]
diff --git a/2022/day11/asd.py b/2022/day11.py
index f89179c..25aa8a7 100755
--- a/2022/day11/asd.py
+++ b/2022/day11.py
@@ -6,8 +6,8 @@ from re import findall
from copy import deepcopy
import sys
-# filename = "ref.txt"
-filename = "pzl.txt"
+# filename = "in/day11.ref"
+filename = "in/day11.pzl"
data = open(filename).read()
num_mon = len([None for _ in data.split('\n\n')])
diff --git a/2022/day1/input.txt b/2022/in/day01.pzl
index 1e725b8..1e725b8 100644
--- a/2022/day1/input.txt
+++ b/2022/in/day01.pzl
diff --git a/2022/day1/input_test.txt b/2022/in/day01.ref
index 2094f91..2094f91 100644
--- a/2022/day1/input_test.txt
+++ b/2022/in/day01.ref
diff --git a/2022/day2/input.txt b/2022/in/day02.pzl
index 1930858..1930858 100644
--- a/2022/day2/input.txt
+++ b/2022/in/day02.pzl
diff --git a/2022/day2/input_test.txt b/2022/in/day02.ref
index db60e36..db60e36 100644
--- a/2022/day2/input_test.txt
+++ b/2022/in/day02.ref
diff --git a/2022/day3/input.txt b/2022/in/day03.pzl
index adf173d..adf173d 100644
--- a/2022/day3/input.txt
+++ b/2022/in/day03.pzl
diff --git a/2022/day3/input_test.txt b/2022/in/day03.ref
index f17e726..f17e726 100644
--- a/2022/day3/input_test.txt
+++ b/2022/in/day03.ref
diff --git a/2022/day4/pzl.txt b/2022/in/day04.pzl
index 107893a..107893a 100644
--- a/2022/day4/pzl.txt
+++ b/2022/in/day04.pzl
diff --git a/2022/day4/ref.txt b/2022/in/day04.ref
index 9f9e9cf..9f9e9cf 100644
--- a/2022/day4/ref.txt
+++ b/2022/in/day04.ref
diff --git a/2022/day5/pzl.txt b/2022/in/day05.pzl
index 802f66b..802f66b 100644
--- a/2022/day5/pzl.txt
+++ b/2022/in/day05.pzl
diff --git a/2022/day5/ref.txt b/2022/in/day05.ref
index 84933bb..84933bb 100644
--- a/2022/day5/ref.txt
+++ b/2022/in/day05.ref
diff --git a/2022/day5/pzl_mod.txt b/2022/in/day05_mod.pzl
index cb5b571..cb5b571 100644
--- a/2022/day5/pzl_mod.txt
+++ b/2022/in/day05_mod.pzl
diff --git a/2022/day5/ref_mod.txt b/2022/in/day05_mod.ref
index baec122..baec122 100644
--- a/2022/day5/ref_mod.txt
+++ b/2022/in/day05_mod.ref
diff --git a/2022/day6/pzl.txt b/2022/in/day06.pzl
index 1db72f1..1db72f1 100644
--- a/2022/day6/pzl.txt
+++ b/2022/in/day06.pzl
diff --git a/2022/day6/ref.txt b/2022/in/day06.ref
index 7980a82..7980a82 100644
--- a/2022/day6/ref.txt
+++ b/2022/in/day06.ref
diff --git a/2022/day7/pzl.txt b/2022/in/day07.pzl
index c988c21..c988c21 100644
--- a/2022/day7/pzl.txt
+++ b/2022/in/day07.pzl
diff --git a/2022/day7/ref.txt b/2022/in/day07.ref
index 01b76da..01b76da 100644
--- a/2022/day7/ref.txt
+++ b/2022/in/day07.ref
diff --git a/2022/day8/pzl.txt b/2022/in/day08.pzl
index e6d0149..e6d0149 100644
--- a/2022/day8/pzl.txt
+++ b/2022/in/day08.pzl
diff --git a/2022/day8/ref.txt b/2022/in/day08.ref
index 16d6fbd..16d6fbd 100644
--- a/2022/day8/ref.txt
+++ b/2022/in/day08.ref
diff --git a/2022/day9/pzl.txt b/2022/in/day09.pzl
index b87df75..b87df75 100644
--- a/2022/day9/pzl.txt
+++ b/2022/in/day09.pzl
diff --git a/2022/day9/ref.txt b/2022/in/day09.ref
index 9874df2..9874df2 100644
--- a/2022/day9/ref.txt
+++ b/2022/in/day09.ref
diff --git a/2022/day9/ref2.txt b/2022/in/day09_2.ref
index 60bd43b..60bd43b 100644
--- a/2022/day9/ref2.txt
+++ b/2022/in/day09_2.ref
diff --git a/2022/day10/pzl.txt b/2022/in/day10.pzl
index 540f82a..540f82a 100644
--- a/2022/day10/pzl.txt
+++ b/2022/in/day10.pzl
diff --git a/2022/day10/ref.txt b/2022/in/day10.ref
index 37ee8ee..37ee8ee 100644
--- a/2022/day10/ref.txt
+++ b/2022/in/day10.ref
diff --git a/2022/day11/pzl.txt b/2022/in/day11.pzl
index f6d24aa..f6d24aa 100644
--- a/2022/day11/pzl.txt
+++ b/2022/in/day11.pzl
diff --git a/2022/day11/ref.txt b/2022/in/day11.ref
index 30e09e5..30e09e5 100644
--- a/2022/day11/ref.txt
+++ b/2022/in/day11.ref