# path6.py: postscript picture of path import sys fout = open("path6.ps",'w') def genf(infile): # output file of MIPS f = open(infile, 'r') for line in f: fout.write(line) N = 6 def itot(i): return (i//N, i%N) def ttoi(t): return t[0]*N + t[1] tour = [17, 21, 29, 33, 25, 12, 1, 14, 6, 2, 10, 23, 34, 26, 30, 19, 27, 16, 5, 9, 13, 0, 8, 4, 15, 28, 32, 24, 20, 31, 18, 7, 3, 11, 22, 35] genf("knight6.init.txt") for i in range(len(tour)-1): (t1, t2) = itot(tour[i]) (t3, t4) = itot(tour[i+1]) fout.write(str(t2)+" "+str(t1)+" "+ str(t4)+" "+str(t3)+" xlineto\n") genf("knight6.term.txt")