Skip to content

Commit f0ab69c

Browse files
committed
Dynamic AUF
1 parent 07897a6 commit f0ab69c

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

term_timer/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from importlib.util import find_spec
33
from typing import Any
44

5+
from cubing_algs.constants import OPPOSITE_FACES
56
from cubing_algs.parsing import parse_moves
67
from cubing_algs.vcube import VCube
78

@@ -84,6 +85,8 @@ def load_config() -> dict[str, Any]:
8485

8586
CUBE_METHOD = CUBE_CONFIG.get('method')
8687

88+
AUF_MOVE = OPPOSITE_FACES[CUBE_ORIENTATION[0]]
89+
8790
TRAINER_STEP = TRAINER_CONFIG.get('step')
8891

8992
DEBUG = bool(os.getenv('TERM_TIMER_DEBUG', None))

term_timer/formatter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import difflib
22

3-
from cubing_algs.constants import AUF_CHAR
43
from cubing_algs.constants import INNER_MOVES
54
from cubing_algs.constants import OUTER_WIDE_MOVES
65
from cubing_algs.constants import PAUSE_CHAR
76
from cubing_algs.constants import ROTATIONS
87

8+
from term_timer.config import AUF_MOVE
99
from term_timer.constants import DNF
1010
from term_timer.constants import MS_TO_NS_FACTOR
1111
from term_timer.constants import SECOND
@@ -195,7 +195,7 @@ def format_alg_aufs(algorithm: str, pre_auf: int, post_auf: int) -> str:
195195
if pre_auf and algorithm:
196196
algorithm_parts = algorithm.split(' ')
197197
for i, move in enumerate(algorithm_parts):
198-
if move[0] == AUF_CHAR:
198+
if move[0] == AUF_MOVE:
199199
algorithm_parts[i] = f'[pre-auf]{ move }[/pre-auf]'
200200
elif move != PAUSE_CHAR:
201201
break
@@ -204,7 +204,7 @@ def format_alg_aufs(algorithm: str, pre_auf: int, post_auf: int) -> str:
204204
if post_auf and algorithm:
205205
algorithm_parts = list(reversed(algorithm.split(' ')))
206206
for i, move in enumerate(algorithm_parts):
207-
if move[0] == AUF_CHAR:
207+
if move[0] == AUF_MOVE:
208208
algorithm_parts[i] = f'[post-auf]{ move }[/post-auf]'
209209
elif move != PAUSE_CHAR:
210210
break

term_timer/methods/base.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
from typing import ClassVar
44

55
from cubing_algs.algorithm import Algorithm
6-
from cubing_algs.constants import AUF_CHAR
76
from cubing_algs.constants import INITIAL_STATE
87
from cubing_algs.masks import FULL_MASK
98
from cubing_algs.parsing import parse_moves
109
from cubing_algs.transform.auf import remove_auf_moves
1110
from cubing_algs.vcube import VCube
1211

13-
from term_timer.config import CUBE_ORIENTATION_MOVES
1412
from term_timer.constants import MS_TO_NS_FACTOR
1513
from term_timer.transform import humanize_moves
1614
from term_timer.transform import prettify_moves
@@ -25,10 +23,7 @@
2523
F2L_FACE = '111111000' # noqa: E221
2624
FULL_FACE = '1' * 9 # noqa: E221
2725

28-
AUF_MOVE = reorient_moves(
29-
CUBE_ORIENTATION_MOVES,
30-
parse_moves(AUF_CHAR),
31-
)[0].base_move
26+
AUF_MOVE = 'D' # Because actually AUF is based on a URFDLB cube and moves
3227

3328
STEPS_CONFIG = {
3429
'Cross': {

0 commit comments

Comments
 (0)