-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrubiks_random.py
More file actions
38 lines (28 loc) · 882 Bytes
/
rubiks_random.py
File metadata and controls
38 lines (28 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python3
"""
@file rubiks_random.py
@brief Generates moves to randomize a Rubiks cube.
@author Evan Elias Young
@date 2018-02-10
@date 2022-02-04
@copyright Copyright 2022 Evan Elias Young. All rights reserved.
"""
import random
def randomize(steps: int = 20) -> list[str]:
"""Will generate a list of steps to randomize a cube.
Args:
steps (integer): The number of steps to list. Defaults to 20.
Returns:
array: The list of steps to randomize the cube.
"""
moves: list[str] = ["R", "L", "B", "D", "F", "U"]
que: list[str] = [random.choice(moves)]
for _ in range(steps):
move = que[-1]
while move == que[-1]:
move = random.choice(moves)
que.append(move)
return que
if __name__ == "__main__":
print("Hello Console!")
print(" ".join(randomize()))