def getBack(self, test=False):
checkingList = []
if test:
backPoint = self.backPoint-300
else:
backPoint = self.backPoint
for i in xrange(self.numCar):
if self.Cars[i].check_getback(backPoint):
checkingList.append(i)
nCar = len(checkingList)
if nCar != 0:
choise = self.newY
shuffle(choise)
color_pro = np.random.sample(nCar) < 0.5
for i, index in enumerate(checkingList):
if color_pro[i]: color = 0
else : color = 1
pos_y = choise[i%len(choise)]
self.Cars[index].resetCar(color, 0, pos_y)
m_carmunk.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录