OFFSET
0,2
COMMENTS
Only 3 directions are allowed, separated by 120 degrees.
o
x
o o
MATHEMATICA
mo={{2, 0}, {-1, 1}, {-1, -1}}; a[0]=1;
a[tg_, p_:{{0, 0}}] := Block[{e, mv = Complement[Last[p]+# & /@ mo, p]}, If[tg == 1, Length@mv, Sum[a[tg-1, Append[p, e]], {e, mv}]]];
a /@ Range[0, 10]
(* Robert FERREOL, Nov 28 2018; after the program of Giovanni Resta in A001411 *)
PROG
(Python)
def add(L, x):
... M=[y for y in L]; M.append(x)
... return(M)
plus=lambda L, M : [x+y for x, y in zip(L, M)]
mo=[[2, 0], [-1, 1], [-1, -1]]
def a(n, P=[[0, 0]]):
... if n==0: return(1)
... mv1 = [plus(P[-1], x) for x in mo]
... mv2=[x for x in mv1 if x not in P]
... if n==1: return(len(mv2))
... else: return(sum(a(n-1, add(P, x)) for x in mv2))
[a(n) for n in range(11)]
# Robert FERREOL, Nov 30 2018
CROSSREFS
KEYWORD
nonn,walk
AUTHOR
Francois Alcover, May 05 2016
STATUS
approved