def main(): w = stdio.readInt() h = stdio.readInt() tour = Tour() while not stdio.isEmpty(): x = stdio.readFloat() y = stdio.readFloat() p = Point(x, y) tour.insertSmallest(p) tour.show() stdio.writef('Tour distance = %f\n', tour.distance()) stdio.writef('Number of points = %d\n', tour.size())
def main(): w = stdio.readInt() h = stdio.readInt() stddraw.setCanvasSize(w, h) stddraw.setXscale(0, w) stddraw.setYscale(0, h) stddraw.setPenRadius(.005) tour = Tour() while not stdio.isEmpty(): x = stdio.readFloat() y = stdio.readFloat() p = Point(x, y) tour.insertSmallest(p) stdio.writef('Tour distance = %f\n', tour.distance()) stdio.writef('Number of points = %d\n', tour.size()) tour.draw() stddraw.show()