Skip to content

Commit 123b708

Browse files
committed
Reduce glitch
1 parent 40d3499 commit 123b708

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

term_timer/scrambler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from random import choices
33
from random import randint
44

5-
from cubing_algs.algorythm import Algorithm
5+
from cubing_algs.algorithm import Algorithm
66
from cubing_algs.constants import OUTER_BASIC_MOVES
77
from cubing_algs.parsing import parse_moves
88
from cubing_algs.transform.mirror import mirror_moves

term_timer/solve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from datetime import timezone
33
from functools import cached_property
44

5-
from cubing_algs.algorythm import Algorithm
5+
from cubing_algs.algorithm import Algorithm
66
from cubing_algs.parsing import parse_moves
77
from cubing_algs.transform.degrip import degrip_full_moves
88
from cubing_algs.transform.optimize import optimize_do_undo_moves

term_timer/timer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ def handle_scrambled(self):
317317
else:
318318
out = ''
319319
algo = parse_moves(self.scrambled).transform(compress_moves)
320+
previous_algo = parse_moves(self.scrambled[:-1]).transform(compress_moves)
321+
320322
for i, move in enumerate(algo.moves):
321323
expected = self.scramble.moves[i]
322324
style = 'move'
@@ -327,8 +329,8 @@ def handle_scrambled(self):
327329

328330
out += f'[{ style }]{ move }[/{ style }] '
329331

330-
# TODO(me): improve to reduce glitches
331-
self.clear_line(full=True)
332+
full_clear = len(algo) < len(previous_algo) or len(algo) <= 1
333+
self.clear_line(full=full_clear)
332334

333335
console.print(
334336
f'[scramble]Scramble #{ len(self.stack) + 1 }:[/scramble]',

0 commit comments

Comments
 (0)