if mytoypool.length_available_list() > 0: break else: t = elf.get_next_available_time() next_t = hrs.next_sanctioned_minute(t) elf.set_next_available_time(next_t) # Etape 2 : Recupérer la productivité de l'elfe productivity = elf.get_productivity() # Gros jouet au hasard r = random.random() if r > RATIO_RANDOM: toy = mytoypool.get_next_longest_toy_for_elf(elf) elf.make_toy(toy, wcsv) continue # Etape 2, Cas 1 : La productivité est supérieure au seuil if productivity > PRODUCTIVITY_THRESHOLD and mytoypool.get_max_available_duration() > MIN_DURATION: # Etape 3 : Récupérer le jouet le plus gros disponible toy = mytoypool.get_next_longest_toy_for_elf(elf) if toy is not None: # Etape 4 : Faire le jouet elf.make_toy(toy, wcsv) else: # On avance d'une minute t = elf.get_next_available_time() next_t = hrs.next_sanctioned_minute(t) elf.set_next_available_time(next_t)