%This program enumerates the number of walks that reach the point x after %N steps. %N total number of steps function nW=getNW(N,x) if abs(x)>N nW=0; else if N==1 nW=1; else nW=getNW(N-1,x-1)+getNW(N-1,x+1); end end