Improve Efficiency - Pixo.transition_image_random

Don't change the destination pixel if it is already what it should be in
the image
This commit is contained in:
David Todd 2020-01-27 13:54:24 -06:00
parent 4eef181fa9
commit 3787d7bae0
1 changed files with 1 additions and 1 deletions

View File

@ -126,7 +126,7 @@ class Pixo:
already_changed = []
while len(already_changed) < TOTAL_DOTS:
dot = random.randrange(0, TOTAL_DOTS)
if dot not in already_changed:
if dot not in already_changed and not BOARD[dot] == image[dot]:
already_changed.append(dot)
BOARD[dot] = image[dot]