def slope_tree_check(lines: list, dx: int, dy: int) -> int:
    """check how many trees would be encountered with a specific slope"""
    x_pos = 0
    y_pos = 0
    trees_encountered = 0
    line_length = len(lines[0])
    while y_pos < len(lines):
        if lines[y_pos][x_pos] == '#':
            trees_encountered += 1
        x_pos = (x_pos + dx) % line_length
        y_pos += dy
    return trees_encountered