def hCurve(n,x,y,win):
if n > 0:
aCurve(n-1,x,y,win)
goSouth(x,y,win)
hCurve(n-1,x,y,win)
goEast(x,y,win)
hCurve(n-1,x,y,win)
goNorth(x,y,win)
bCurve(n-1,x,y,win)
def aCurve(n,x,y,win):
if n > 0:
hCurve(n-1,x,y,win)
goEast(x,y,win)
aCurve(n-1,x,y,win)
goSouth(x,y,win)
aCurve(n-1,x,y,win)
goWest(x,y,win)
cCurve(n-1,x,y,win)
def find_length(n,w):
# return the length of segment whill will allow curve of size in to fit
# a canvas of width = w
return ??
def main():
n = int(sys.argv[1])
WIDTH = 1024
HEIGHT = 1024
win = Graphics......
length = find_length(n,WIDTH)
hCurve(n,14,14,length,win)
length(0) = 0
length(n) = 4 * length(n-1) + 3
length(n) = 4 * length(n-1) + 3
= 4 * (4 * length(n-2) + 3) + 3
= ...
length(n) = 4**n - 1
Recurrence relations
n length
----------
0 0
1 3
2 15
3 63
n = 3
7 segments
n= 4
15 segments
int x;
x = 22;
int *p;
s = SupplierNode("s12","Jones")
1301, 1302, 2510
2720 (Shiraj Pokharel),
3320 (Peng Wang, Weeks, Ashok) leads to 4320, 4330, .....
3210 (???) has least impact on future classes