All pastes #1419796 Raw Edit

fuckin'o

public text v1 · immutable
#1419796 ·published 2009-05-11 22:13 UTC
rendered paste body
 fun findempo [] (x,y) = false
 | findempo S (x,y)  = if hd S = (x,y) then true else findempo (tl S) (x,y);

fun  voltes   xmax ymax  Tmax   (xage,yage)  (xtel,ytel)  L =   
   
   if  ( (Tmax = 0) andalso (xage = xtel) andalso (yage = ytel) )  then
               1
        else     if ( (Tmax <= 0) orelse ( xage  <= 0 )  orelse  ( yage <= 0 ) 
                         orelse  ( xage > xmax  )  orelse  ( yage > ymax  )
                         orelse  (   findempo  L  (xage,yage) )  )  then
                       0
               else  
               voltes   xmax ymax  (Tmax-1)   ((xage-1),yage) (xtel,ytel) L +
               voltes   xmax ymax  (Tmax-1)   ((xage+1),yage) (xtel,ytel) L +
               voltes   xmax ymax  (Tmax-1)   (xage,(yage-1)) (xtel,ytel) L +
               voltes   xmax ymax  (Tmax-1)   (xage,(yage+1)) (xtel,ytel) L;