Zum Inhalt

Move

Move

__init__(self, move) special

Initializes a new move object

Parameters:

Name Type Description Default
move str

String representation of the move

required
Source code in core/solver/Move.py
121
122
123
124
125
126
127
128
129
130
def __init__(self, move: str):
    """
    Initializes a new move object

    Args:
        move (str): String representation of the move
    """
    self.face = move[0]
    self.twice = True if len(move) > 1 and move[1] == "2" else False
    self.inverse = True if len(move) > 1 and move[1] == "'" else False

__str__(self) special

Gets the string representation of the move

Returns:

Type Description
[type]

String representation of the move

Source code in core/solver/Move.py
132
133
134
135
136
137
138
139
140
141
142
143
def __str__(self):
    """
    Gets the string representation of the move

    Returns:
        [type]: String representation of the move
    """
    if self.twice:
        return self.face + '2'
    if self.inverse:
        return self.face + "'"
    return self.face

changes(self)

Gets the changes that this move will do to a cube

Returns:

Type Description
List[Tuple[str, str]]

List[Tuple[str, str]]: Changes for this move

Source code in core/solver/Move.py
145
146
147
148
149
150
151
152
def changes(self) -> List[Tuple[str, str]]:
    """
    Gets the changes that this move will do to a cube

    Returns:
        List[Tuple[str, str]]: Changes for this move
    """
    return MOVES[self.face]

for_face(self, face)

Allows you to transform the move to be applied to a different face: Move('F').for_face('B') <=> Move('B') For 'U', down would be the normal front For 'D', up would be the normal front

Parameters:

Name Type Description Default
face str

Face for which to transform this move to

required

Returns:

Type Description
[type]

The transformed move

Source code in core/solver/Move.py
155
156
157
158
159
160
161
162
163
164
165
166
167
168
def for_face(self, face: str):
    """
    Allows you to transform the move to be applied to a different face: Move('F').for_face('B') <=> Move('B')
    For 'U', down would be the normal front
    For 'D', up would be the normal front

    Args:
        face (str): Face for which to transform this move to

    Returns:
        [type]: The transformed move
    """
    self.face = MAPPING[face][self.face]
    return self