1 import matplotlib.pyplot as plt
 2 from random_walk import RandomWalk
 3 
 4 while True:
 5 
 6     rw = RandomWalk()
 7     rw.fill_walk()
 8     point_numbers = list(range(rw.num_points))
 9     plt.scatter(rw.x_values,rw.y_values,c=point_numbers, cmap=plt.cm.Blues,
10 edgecolor='none', s=15)
11     plt.scatter(0,0,c='red',edgecolors='none',s=100)
12     plt.scatter(rw.x_values[-1],rw.y_values[-1],c='red',edgecolors='none',s=100)
13     plt.axes().get_xaxis().set_visible(False)
14     plt.axes().get_yaxis().set_visible(False)
15     plt.show()
16 
17     keep_running = input("Make another walk(y/n):")
18     if keep_running =="n":
19         breaks

 

posted on 2018-04-24 17:53  朱律波  阅读(104)  评论(0编辑  收藏  举报