b:= proc(x, y, h, t) option remember; `if`(y<0 or y>x, 0,
`if`(x=0, `if`(h>1, 0, 1), `if`(t=1 and abs(y-h)<>1, 0,
b(x-1, y-1, `if`(t=1, y, h), 0))+b(x-1, y+1, h, 1)))
end:
a:= n-> b(2*n, 0$3):
seq(a(n), n=0..50);
# Alternative:
b:= proc(x, y) option remember; (t->
`if`(x=t, 1, `if`(x<t, 0, b(x-1-2*y, y+1)+add(add(
b(x-1-2*i, y+j), j=[-1, 1]), i=1..y-1))))(3*y-2)
end:
a:= n-> `if`(n=0, 1, b(2*n-1, 1)):
seq(a(n), n=0..50);