3 moves=("1,1" "3,1" "5,1" "7,1" "1,2")
8 cur_down=-1 # we want to skip the very first line
11 for line in $(<input.txt); do
12 cur_down=$((cur_down+1))
13 if [ $cur_down -eq $down ]; then
16 if [ $pos -ge ${#line} ]; then
17 pos=$((pos - ${#line}))
19 if [ ${line:$pos:1} = "#" ]; then
20 tree_count=$((tree_count+1))
28 for move in ${moves[@]}; do
31 trees=$(count_trees $right $down)
32 echo "Move: $move has $trees trees"
33 mult_total=$((mult_total * $trees))
36 echo "Answer: $mult_total"
46 move_types = ((1,1), (3,1), (5,1), (7,1), (1,2))
48 for move in move_types:
53 for line in open("input.txt", "r"):
55 print(move[1], line_offset)
56 if line_offset < move[1] or first_line:
58 if line_offset >= move[1]:
62 if line[position] == "#":
65 if position >= len(line):
66 position = position - len(line)
67 trees_count.append(tree_count)
75 print("There were", mult_result, "trees")