def _add_coach(fieldid, fields):
    global coaches
    num = len(fields)
    if num < pf_min_size:
        return
    
    if num > pf_unit_size:
        dist_num = num / pf_unit_size
    else:
        dist_num = 1
    if dist_num > pf_max_dist_num:
        dist_num = pf_max_dist_num
    size = num / dist_num
    i = 0
    j = 0
    while i < num:
        subfieldid = "%s-%d" % (fieldid, j)
        coaches[subfieldid] = coach(subfieldid, pf_capacity, elite_num, fields[i:i+size])
        i += size
        j += 1
Exemple #2
0
 def _add_coach(self, fieldid, fields):
     num = len(fields)
     if num < self.pf_min_size:
         return
     
     if num > self.pf_unit_size:
         dist_num = num / self.pf_unit_size
     else:
         dist_num = 1
     if dist_num > self.pf_max_dist_num:
         dist_num = self.pf_max_dist_num
     size = num / dist_num
     i = 0
     j = 0
     while i < num:
         subfieldid = "%s-%d" % (fieldid, j)
         self.coaches[subfieldid] = coach(subfieldid, self.pf_capacity, \
                                     self.elite_num, fields[i:i+size])
         i += size
         j += 1