I know that a forest has the shape of a triangle with vertices of coordinates (0, 0), (196, 0),

and (98, 98). Row p contains the trees in the positions (p, p), (p+ 2, p), (p+ 4, p), . . . ,(196−p, p),

where 0 <= p <=98.

How can I estimate the expected number of hours after the tree of coordinates (98, 98)

catches fire, if the first burning tree has coordinates (100, 50), and the probability that at least one quarter of the forest will burn after h hours, if the first burning tree has coordinates (98, 98) (h = 20, 30, 40, 50, 60, 70).

Now what i made in rstudio:

S=function(forest,i,j){

if (i+j==198 | i==j)

return (-1);

return (forest[i-1,j]);

}

fire= function(forest,i,j){

S=S(forest,i.j);

NE=NE(forest,i,j);

NV=NV(forest,i,j);

SE=SE(forest,i,j);

SV=SV(forest,i,j);

V=V(forest,i,j);

N=N(forest,i,j);

E=E(forest,i,j);

if (NV==1){

prob=runif(1,1,100)

if (prob<=70)

return (1);

}

if (V==1 | S==1){

prob=runif(1,1,100)

if (prob<=30)

return (1);

}

if (N==1 | E==1){

prob=runif(1,1,100)

if (prob<=50)

return (1);

}

if (NV==1 | SE==1){

prob=unif(1,1,100)

if (prob<=40)

return (1);

}

}

A little help? I don t know how to write in rstudio first paragraph. I search hours. At least one site.