Esempio n. 1
0
 def get_n_combinations(self):
   '''
   This method is applied to "wpattern" (in fact, array, its list transform) that is pointer to by the parcours_index, ie, the current wpattern
   
   Eg.
     Suppose current wpattern is '02211' (notice tildefiner is 5,6 in the example)
     Because TilR equally occupies the slots, there are, in the example of Megasena, 12 dozens per slot (5 slots total, 60 dozens altogether)
     So the n. of combinations will be:
     
     afc.combineNbyC(12,0) * afc.combineNbyC(12,2) * afc.combineNbyC(12,2) * afc.combineNbyC(12,1) * afc.combineNbyC(12,1) =
     = 1 * 66 * 66 * 12 * 12 = 
     = 627264 combinations
   '''
   remainder = self.volante_caract.n_dezenas_no_volante % self.tildefiner.n_slots
   if remainder != 0:
     # not yet implemented
     raise ValueError, 'TilProducerNB has not yet implemented Tils with n_slots not dividing total dozens in gamecard.'
     # return None
   total_elems_per_slot = self.volante_caract.n_dezenas_no_volante / self.tildefiner.n_slots
   array = self.get_pattern()
   total_combinations = 1
   for n_elems_happening_in_slot in array:
     total_combinations *= afc.combineNbyC(total_elems_per_slot, n_elems_happening_in_slot)
   return total_combinations
Esempio n. 2
0
 def __len__(self):
   return combineNbyC(self.N_DEZENAS_NO_VOLANTE, self.N_DEZENAS_NO_SORTEIO)