-
Notifications
You must be signed in to change notification settings - Fork 0
/
aoc_d3.py
68 lines (55 loc) · 1.2 KB
/
aoc_d3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
my_file = open("day3_1.txt", "r")
content = my_file.readlines()
x_axis = 0
trees_1 = 0 #+1
trees_2 = 0 #+3
trees_3 = 0 #+5
trees_4 = 0 #+7
trees_5 = 0
mod_value = 31
for c in content:
mod_value = 31
if c[x_axis % mod_value] == "#":
# print c
trees_1 = trees_1 + 1
x_axis = x_axis + 1
#+3
x_axis = 0
for c in content:
mod_value = 31
if c[x_axis % mod_value] == "#":
# print c
trees_2 = trees_2 + 1
x_axis = x_axis + 3
#+5
x_axis = 0
for c in content:
mod_value = 31
if c[x_axis % mod_value] == "#":
# print c
trees_3 = trees_3 + 1
x_axis = x_axis + 5
#+7
x_axis = 0
for c in content:
mod_value = 31
if c[x_axis % mod_value] == "#":
# print c
trees_4 = trees_4 + 1
x_axis = x_axis + 7
x_axis = 0
for c in content[::2]:
mod_value = 31
if c[x_axis % mod_value] == "#":
# print c
trees_5 = trees_5 + 1
x_axis = x_axis + 1
print (trees_1, trees_2, trees_3, trees_4, trees_5)
print (trees_1 * trees_2 * trees_3 * trees_4 * trees_5)
#print (set(content_list) & set(nl1))
#print (set(nl1) & set(nl2))
# print(content_list)
# find sum = 9
# 1,2,3,4 original list
# 8,7,6,5 nl1
# 4, 2, 0, -2