Does someone know why level 3 is more effective than 2 or 1? Even though level 3 runs on the entire length of 'possibilities' it got calculated faster than levels 2 and 1.
temp_possibilities = possibilities.copy()
index = 0
if level == 3:
for possibility in possibilities:
if check_choice(computer_guesses[rounds - 2], possibility) != round_hits:
temp_possibilities.remove(possibility)
elif level == 2:
length = len(possibilities)
while index < length:
possibility = possibilities[index]
if check_choice(computer_guesses[rounds - 2], possibility) != round_hits:
temp_possibilities.remove(possibility)
index += 2
else: # level 1
length = len(possibilities)
while index < length:
possibility = possibilities[index]
if check_choice(computer_guesses[rounds - 2], possibility) != round_hits:
temp_possibilities.remove(possibility)
index += 3
source https://stackoverflow.com/questions/73085058/why-does-the-code-below-is-more-effective-on-level-3-than-levels-2-or-1
Comments
Post a Comment