'''
Time to check the rest of the slopes - you need to minimize the probability of a sudden arboreal stop, after all.

Determine the number of trees you would encounter if, for each of the following slopes, you start at the top-left corner and traverse the map all the way to the bottom:

Right 1, down 1.
Right 3, down 1. (This is the slope you already checked.)
Right 5, down 1.
Right 7, down 1.
Right 1, down 2.
In the above example, these slopes would find 2, 7, 3, 4, and 2 tree(s) respectively; multiplied together, these produce the answer 336.

What do you get if you multiply together the number of trees encountered on each of the listed slopes?
'''
inputGrid = []

with open("Data\input.txt", "r") as inputFile:
    inputGrid = [line.strip() for line in inputFile]

slopes = [(1,1), (3, 1), (5, 1), (7, 1), (1, 2)]
hits = []

for slope in slopes:
    currentCoords = [0, 0]

    hitCounter = 0

    while True:
        if inputGrid[currentCoords[1]][currentCoords[0]] == "#":
            hitCounter += 1

        currentCoords[1] += slope[1]
        if currentCoords[1] >= len(inputGrid):
            break

        currentCoords[0] += slope[0]
        if currentCoords[0] >= len(inputGrid[currentCoords[1]]):
            currentCoords[0] -= len(inputGrid[currentCoords[1]])

    hits.append(hitCounter)

result = 1
for hit in hits:
    result *= hit
print(hits)
print(result)