Updated local repo
This commit is contained in:
parent
1d187ed320
commit
33708ebb29
3
2015/day6/exp
Normal file
3
2015/day6/exp
Normal file
@ -0,0 +1,3 @@
|
||||
turn on 2,3 through 4,4
|
||||
turn off 1,2 through 3,2
|
||||
toggle 5,0 through 7,3
|
25
2021/day1/day1.sh
Executable file
25
2021/day1/day1.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
count=0
|
||||
grow=0
|
||||
prev=0
|
||||
while IFS= read -r line; do
|
||||
echo $count $grow $prev
|
||||
if [ $count -eq 0 ]; then
|
||||
echo "This is the first line, we skip it (prev="$prev", line="$line")"
|
||||
prev=$line
|
||||
echo "prev=$prev, line=$line"
|
||||
|
||||
else
|
||||
if [ $line > $prev ]; then
|
||||
echo $count": "$line" > "$prev
|
||||
((grov++))
|
||||
prev=$line
|
||||
fi
|
||||
fi
|
||||
|
||||
((count++))
|
||||
done < day1_test.txt
|
||||
|
||||
echo "I can through $count lines"
|
||||
echo "I found $grov depth measurement increases"
|
2000
2021/day1/day1_data.txt
Normal file
2000
2021/day1/day1_data.txt
Normal file
File diff suppressed because it is too large
Load Diff
10
2021/day1/day1_test.txt
Normal file
10
2021/day1/day1_test.txt
Normal file
@ -0,0 +1,10 @@
|
||||
199
|
||||
200
|
||||
208
|
||||
210
|
||||
200
|
||||
207
|
||||
240
|
||||
269
|
||||
260
|
||||
263
|
1000
2021/day2/day2_data.txt
Normal file
1000
2021/day2/day2_data.txt
Normal file
File diff suppressed because it is too large
Load Diff
6
2021/day2/day2_test.txt
Normal file
6
2021/day2/day2_test.txt
Normal file
@ -0,0 +1,6 @@
|
||||
forward 5
|
||||
down 5
|
||||
forward 8
|
||||
up 3
|
||||
down 8
|
||||
forward 2
|
1000
2021/day3/day3_data.txt
Normal file
1000
2021/day3/day3_data.txt
Normal file
File diff suppressed because it is too large
Load Diff
12
2021/day3/day3_test.txt
Normal file
12
2021/day3/day3_test.txt
Normal file
@ -0,0 +1,12 @@
|
||||
00100
|
||||
11110
|
||||
10110
|
||||
10111
|
||||
10101
|
||||
01111
|
||||
00111
|
||||
11100
|
||||
10000
|
||||
11001
|
||||
00010
|
||||
01010
|
87
2021/day4/day4_part2.py
Normal file
87
2021/day4/day4_part2.py
Normal file
@ -0,0 +1,87 @@
|
||||
import numpy as np
|
||||
import re, sys
|
||||
|
||||
filename = open(sys.argv[1],"r")
|
||||
x = []
|
||||
xr = filename.readlines()[0].strip()
|
||||
|
||||
#print(filename.readline().rstrip())
|
||||
|
||||
#for i in filename.readlines():
|
||||
# print (i.strip())
|
||||
|
||||
|
||||
|
||||
|
||||
llist=[]
|
||||
|
||||
bingo_numbers=[]
|
||||
with open(sys.argv[1]) as f:
|
||||
# x = [ j for j in x.split() ]
|
||||
|
||||
#lines = f.readlines()
|
||||
#lines = [line.rstrip() for line in lines]
|
||||
for line in f:
|
||||
if re.search("^[0-9]+,",line.rstrip()):
|
||||
bingo_numbers = [int(i) for i in line.rstrip().split(',')]
|
||||
else:
|
||||
for x in line.rstrip().split(' '):
|
||||
if x != '':
|
||||
llist.append(x)
|
||||
|
||||
plates = len(llist)/25
|
||||
numbers=np.zeros((int(plates),5,5))
|
||||
bingo=np.zeros((int(plates),5,5))
|
||||
for l in range(0,int(plates)):
|
||||
for i in range(0,5):
|
||||
for j in range(0,5):
|
||||
numbers[l][i][j]=llist[0]
|
||||
llist.pop(0)
|
||||
#print()
|
||||
#print()
|
||||
print("----")
|
||||
print(bingo_numbers)
|
||||
|
||||
force_break = False
|
||||
called_numbers = []
|
||||
winner = []
|
||||
already_called = []
|
||||
for k in range(0,len(bingo_numbers)):
|
||||
for l in range(0,int(plates)):
|
||||
if l not in already_called:
|
||||
print('-----')
|
||||
print (l)
|
||||
print (already_called)
|
||||
print('>><<')
|
||||
if len(already_called) == int(plates)-1:
|
||||
force_break = True
|
||||
print('LAST IS NR ' + str(l))
|
||||
called_numbers.append(bingo_numbers[0])
|
||||
bingo_numbers.pop(0)
|
||||
break
|
||||
for i in range(0,5):
|
||||
for j in range(0,5):
|
||||
if numbers[l][i][j] == bingo_numbers[0]:
|
||||
bingo[l][i][j] = 1
|
||||
if sum(bingo[l][i]) == 5:
|
||||
winner = numbers[l]
|
||||
already_called.append(l)
|
||||
#print(numbers[l])
|
||||
#force_break = True
|
||||
#break
|
||||
if force_break:
|
||||
break
|
||||
|
||||
|
||||
print(called_numbers)
|
||||
print(winner)
|
||||
|
||||
winner_sum = 0
|
||||
|
||||
for i in winner:
|
||||
for j in i:
|
||||
if int(j) not in called_numbers:
|
||||
winner_sum += int(j)
|
||||
|
||||
print(winner_sum*called_numbers[-1])
|
||||
|
19
2021/day4/test_input
Normal file
19
2021/day4/test_input
Normal file
@ -0,0 +1,19 @@
|
||||
7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1
|
||||
|
||||
22 13 17 11 0
|
||||
8 2 23 4 24
|
||||
21 9 14 16 7
|
||||
6 10 3 18 5
|
||||
1 12 20 15 19
|
||||
|
||||
3 15 0 2 22
|
||||
9 18 13 17 5
|
||||
19 8 7 25 23
|
||||
20 11 10 24 4
|
||||
14 21 16 12 6
|
||||
|
||||
14 21 17 24 4
|
||||
10 16 15 9 19
|
||||
18 8 23 26 20
|
||||
22 11 13 6 5
|
||||
2 0 12 3 7
|
60
2021/day5/day5_part1.py
Normal file
60
2021/day5/day5_part1.py
Normal file
@ -0,0 +1,60 @@
|
||||
import numpy as np
|
||||
import re
|
||||
import sys
|
||||
|
||||
f = open(sys.argv[1],"r")
|
||||
cords=[]
|
||||
|
||||
llist=[]
|
||||
|
||||
for line in f:
|
||||
if re.search("^[0-9]",line.rstrip()):
|
||||
for i in line.rstrip().split(' -> '):
|
||||
llist.append(i.rstrip().split(','))
|
||||
|
||||
|
||||
max_x = 0
|
||||
max_y = 0
|
||||
for i in llist:
|
||||
if int(i[0]) > max_x:
|
||||
max_x = int(i[0])
|
||||
|
||||
if int(i[1]) > max_y:
|
||||
max_y = int(i[1])
|
||||
|
||||
#field = np.zeros((int(max_y)+1,int(max_x)+1))
|
||||
field = np.zeros((1000,1000))
|
||||
|
||||
for i in range(0,len(llist)-1,2):
|
||||
x = int(llist[i][0])
|
||||
y = int(llist[i][1])
|
||||
|
||||
X = int(llist[i+1][0])
|
||||
Y = int(llist[i+1][1])
|
||||
#print('Compare ' + str(x)+','+str(y)+' and '+ str(X) + ',' + str(Y))
|
||||
if x != X and y == Y:
|
||||
if x > X:
|
||||
temp = x
|
||||
x = X
|
||||
X = temp
|
||||
print('X: Going from ' + str(x) + ' to ' + str(X))
|
||||
for j in range(x,X+1):
|
||||
field[y][j] += 1
|
||||
#print(field)
|
||||
if y != Y and x == X:
|
||||
print('Y: Going from ' + str(y) + ' to ' + str(Y))
|
||||
if y > Y:
|
||||
temp = y
|
||||
y = Y
|
||||
y = temp
|
||||
for j in range(y,Y+1):
|
||||
field[j][x] += 1
|
||||
#print(field)
|
||||
|
||||
count = 0
|
||||
|
||||
for i in field:
|
||||
for j in i:
|
||||
if int(j) >= 2: count+=1
|
||||
|
||||
print(count)
|
10
2021/day5/test_input
Normal file
10
2021/day5/test_input
Normal file
@ -0,0 +1,10 @@
|
||||
0,9 -> 5,9
|
||||
8,0 -> 0,8
|
||||
9,4 -> 3,4
|
||||
2,2 -> 2,1
|
||||
7,0 -> 7,4
|
||||
6,4 -> 2,0
|
||||
0,9 -> 2,9
|
||||
3,4 -> 1,4
|
||||
0,0 -> 8,8
|
||||
5,5 -> 8,2
|
1
2021/day6/test_input
Normal file
1
2021/day6/test_input
Normal file
@ -0,0 +1 @@
|
||||
3,4,3,1,2
|
14
2022/day1/test_input
Normal file
14
2022/day1/test_input
Normal file
@ -0,0 +1,14 @@
|
||||
1000
|
||||
2000
|
||||
3000
|
||||
|
||||
4000
|
||||
|
||||
5000
|
||||
6000
|
||||
|
||||
7000
|
||||
8000
|
||||
9000
|
||||
|
||||
10000
|
3
2022/day2/test_input
Normal file
3
2022/day2/test_input
Normal file
@ -0,0 +1,3 @@
|
||||
A Y
|
||||
B X
|
||||
C Z
|
6
2022/day3/test_input
Normal file
6
2022/day3/test_input
Normal file
@ -0,0 +1,6 @@
|
||||
vJrwpWtwJgWrhcsFMMfFFhFp
|
||||
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
|
||||
PmmdzqPrVvPwwTWBwg
|
||||
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
|
||||
ttgJtRGJQctTZtZT
|
||||
CrZsJsPPZsGzwwsLwLmpwMDw
|
6
2022/day4/test_input
Normal file
6
2022/day4/test_input
Normal file
@ -0,0 +1,6 @@
|
||||
2-4,6-8
|
||||
2-3,4-5
|
||||
5-7,7-9
|
||||
2-8,3-7
|
||||
6-6,4-6
|
||||
2-6,4-8
|
4
2022/day5/test_input
Normal file
4
2022/day5/test_input
Normal file
@ -0,0 +1,4 @@
|
||||
move 1 from 2 to 1
|
||||
move 3 from 1 to 3
|
||||
move 2 from 2 to 1
|
||||
move 1 from 1 to 2
|
1
2022/day6/test_input
Normal file
1
2022/day6/test_input
Normal file
@ -0,0 +1 @@
|
||||
mjqjpqmgbljsphdztnvjfqwrcgsmlb
|
1
2022/day6/test_input2
Normal file
1
2022/day6/test_input2
Normal file
@ -0,0 +1 @@
|
||||
bvwbjplbgvbhsrlpgdmjqwftvncz
|
1
2022/day6/test_input3
Normal file
1
2022/day6/test_input3
Normal file
@ -0,0 +1 @@
|
||||
nppdvjthqldpwncqszvftbrmjlhg
|
1
2022/day6/test_input4
Normal file
1
2022/day6/test_input4
Normal file
@ -0,0 +1 @@
|
||||
nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg
|
1
2022/day6/test_input5
Normal file
1
2022/day6/test_input5
Normal file
@ -0,0 +1 @@
|
||||
zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw
|
23
2022/day7/test_input
Normal file
23
2022/day7/test_input
Normal file
@ -0,0 +1,23 @@
|
||||
$ cd /
|
||||
$ ls
|
||||
dir a
|
||||
14848514 b.txt
|
||||
8504156 c.dat
|
||||
dir d
|
||||
$ cd a
|
||||
$ ls
|
||||
dir e
|
||||
29116 f
|
||||
2557 g
|
||||
62596 h.lst
|
||||
$ cd e
|
||||
$ ls
|
||||
584 i
|
||||
$ cd ..
|
||||
$ cd ..
|
||||
$ cd d
|
||||
$ ls
|
||||
4060174 j
|
||||
8033020 d.log
|
||||
5626152 d.ext
|
||||
7214296 k
|
5
2022/day8/test_input
Normal file
5
2022/day8/test_input
Normal file
@ -0,0 +1,5 @@
|
||||
30373
|
||||
25512
|
||||
65332
|
||||
33549
|
||||
35390
|
10
2023/day10/t2.2
Normal file
10
2023/day10/t2.2
Normal file
@ -0,0 +1,10 @@
|
||||
.F----7F7F7F7F-7....
|
||||
.|F--7||||||||FJ....
|
||||
.||.FJ||||||||L7....
|
||||
FJL7L7LJLJ||LJ.L-7..
|
||||
L--J.L7...LJS7F-7L7.
|
||||
....F-J..F7FJ|L7L7L7
|
||||
....L7.F7||L7|.L7L7|
|
||||
.....|FJLJ|FJ|F7|.LJ
|
||||
....FJL-7.||.||||...
|
||||
....L---J.LJ.LJLJ...
|
10
2023/day10/t2.3
Normal file
10
2023/day10/t2.3
Normal file
@ -0,0 +1,10 @@
|
||||
FF7FSF7F7F7F7F7F---7
|
||||
L|LJ||||||||||||F--J
|
||||
FL-7LJLJ||||||LJL-77
|
||||
F--JF--7||LJLJ.F7FJ-
|
||||
L---JF-JLJ....FJLJJ7
|
||||
|F|F-JF---7...L7L|7|
|
||||
|FFJF7L7F-JF7..L---7
|
||||
7-L-JL7||F7|L7F-7F7|
|
||||
L.L7LFJ|||||FJL7||LJ
|
||||
L7JLJL-JLJLJL--JLJ.L
|
@ -2,7 +2,7 @@ FF7F┼F7F7F7F7F7F---7
|
||||
L|LJ||||||||||||F--J
|
||||
FL-7LJLJ|S||||LJL-77
|
||||
F--JF--7||LJLJ7F7FJ-
|
||||
L---JF-JFJ.||-FJLJJ7
|
||||
L---JF-JLJ.||-FJLJJ7
|
||||
|F|F-JF---7F7-L7L|7|
|
||||
|FFJF7L7F-JF7|JL---7
|
||||
7-L-JL7||F7|L7F-7F7|
|
||||
|
@ -1,23 +0,0 @@
|
||||
J2566 131
|
||||
K7KK7 272
|
||||
AA222 222
|
||||
222AA 123
|
||||
44T55 467
|
||||
4K339 546
|
||||
42TT2 174
|
||||
TQTTT 710
|
||||
84766 682
|
||||
K22KK 607
|
||||
77595 922
|
||||
26778 768
|
||||
JJ667 198
|
||||
JJ2JJ 123
|
||||
44Q9A 821
|
||||
T6682 851
|
||||
3A232 890
|
||||
5Q5J4 691
|
||||
79789 305
|
||||
KK666 138
|
||||
TT9TT 742
|
||||
Q4276 489
|
||||
6T48J 921
|
@ -1,9 +0,0 @@
|
||||
2J345 213
|
||||
22345 425
|
||||
2JJ34 654
|
||||
22234 234
|
||||
2JJJ3 623
|
||||
22223 658
|
||||
J2JJJ 987
|
||||
2JJJJ 456
|
||||
22222 604
|
Loading…
Reference in New Issue
Block a user