Class 39 — Monday, November 29

Chrestomathics

WWAHD — A strategy to embrace — I know that I do


Look both ways


Agenda



Discussion

3 TSP tours

cities = [ (281, 234), (515, 321), (738, 44), (530, 60), (410, 377), (135, 293),

  (883, 158), (366, 307), (380, 166), (881, 34) ]

3 TSP tours

start_tour = [ 0, 7, 4, 8, 1, 3, 9, 6, 2, 5 ]

mid_tour = [ 0, 7, 5, 4, 1, 2, 9, 6, 3, 8 ]

end_tour = [ 0, 5, 4, 1, 7, 8, 3, 2, 9, 6 ]



Your task


Function random_location( w, h )

testing random_location()

w: 1000

h: 500

random_location( w, h ): (355, 250)



Function initialize_city_locations( n, w, h )

testing initialize_city_locations()

n: 4

w: 1000

h: 500

initialize_city_locations( n, w, h ): [(281, 234), (515, 321), (738, 44), (530, 60)]