THE CHALLENGE: Create a program that calls a recursive function which calls a recursive function which calls the original recursive function. # The program must terminate. Bonus points for doing something cool! ! !
For example, a program that consists of two functions, A and B.
Function A would be a recursive function that called itself. Function A also calls Function B.
Function B would be a recursive function that called itself. Function B also calls Function A.
Name:
Anonymous2012-02-02 22:56
Need heuristics for A* search for finding optimal path through a pacman maze. No ghosts, just food. Help pacman find the shortest path to get all food. Thoughts?
Name:
Anonymous2012-02-02 22:56
Need heuristics for A* search for finding optimal path through a pacman maze. No ghosts, just food. Help pacman find the shortest path to get all food. Thoughts?
def bwfs(v, i = 1, d = 0):
print d, i, v, labels[v]
if not labels[v]: yield v
labels[v] = i
for u in neighbours[v]:
if 0 < labels[u] < i:
for r in bwfs(u, i, d + 1):
yield r
for u in neighbours[v]:
if labels[u] == 0:
for r in bwfs(u, i + 1, d + 1):
yield r