import math


def burning_probability(theta, V, c1, c2, Ph, Pden, Pveg):
    """
        This function calculates the probability of a cell
        to catch fire (go to burning state) based on the Pveg and Pden
        of the cell as well as the location of the neighbouring cell relative 
        to the cell and the north. The location of the neighbour cell impacts the
        burning probability of the cell due to wind speed and direction
        Input:
            theta:  int - angle based on position of neighbouring cell
            V:      int - wind speed
            c1:     float - wind constant
            c2:     float - float constant
            Ph:     float - constant probability that a cell adjacent to a burning cell 
                            containing a given type of vegetation and density
                            will catch fire at the next time step under no wind and flat terrain conditions
            Pden:   float - type of vegetation in the cell
            Pveg:   float - density of the vegetation in the cell
        Output:
            Pburn: float -  the probability that a cell adjecent to a burning cell will 
                            catch fire in the next time step
    """
    # compute wind effects
    ft = math.e**(V*c2*(math.cos(theta)-1))
    Pw = ft*math.e**(c1*V)

    # compute burning probability
    Pburn = Ph*(1+Pden)*(1+Pveg)*Pw
    
    return Pburn



                        #### MAIN PROGRAM ####