def getVehiclesFromFile(fileName, route): vehicleList = [] vehicleTypes = VehicleTypes() for i,line in enumerate(open(fileName)): if line[0] == 'n': continue vehicleType = vehicleTypes.getTypeFromC(line[0]) vehicle = Vehicle(vehicleType, route, i, SimpleLaneMovement(), 1, int(line[1]), i, vehicleTypes.color[vehicleType]) vehicleList.append(vehicle) print len(vehicleList) return vehicleList
def getVehiclesFromFileReal(fileName, route): vehicleList = [] vehicleTypes = VehicleTypes() vehicleMover = nnBasedMovement() for i, line in enumerate(open(fileName)): if line[0] == 'n': continue vehicleType = vehicleTypes.getTypeFromC(line[0]) vehicle = Vehicle(vehicleType, route, i, vehicleMover, int(30 * random.random()), int(line[1]), i, vehicleTypes.color[vehicleType]) vehicleList.append(vehicle) print len(vehicleList) return vehicleList