The Mystery of the Missing Code: At about minute 20 of lecture 6 in 6.00SC (which is part of the week 5 assignment of the Mechanical MOOC course), Professor Grimson throws in two examples of code for recursive definitions that are not included in the downloadable code file. Has anyone out there recreated this code, and if so, can you share out?
def simpleExp(b, n):
if n == 0:
return n * simpleExp( b, n-1)
and a few minutes later in the lecture after his demonstration with the stacking toy, he presents the Hanoi function
def Hanoi(n, f, t, s):
if n == 1:
print “Move from ” + f + ” to ” + t
Hanoi( n-1, f, s, t )
Hanoi( 1, f, t, s)
Hanoi( n-1, s, t, f )
I haven’t coded or tested this but it seems to fit with what he presented and make sense logically. Was this what you wanted? Yeah it can be a real eyestrain trying to make out that fuzzy video sometimes.