File tree Expand file tree Collapse file tree 8 files changed +1123
-2
lines changed Expand file tree Collapse file tree 8 files changed +1123
-2
lines changed Original file line number Diff line number Diff line change 198
198
distributed under the License is distributed on an "AS IS" BASIS,
199
199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
200
See the License for the specific language governing permissions and
201
- limitations under the License.
201
+ limitations under the License.
Original file line number Diff line number Diff line change 1
- # MagicCube
1
+ # MagicCube
2
+
3
+ Python 3 implementation of a (3x3x3) Rubik's Cube utility.
4
+
5
+ ![ 3x3x3 Rubik's Cube] ( cube.png )
6
+
7
+ ## Installation
8
+
9
+ Clone the repository and navigate to the project directory:
10
+
11
+ ``` bash
12
+ git clone < repo_url>
13
+ cd rubiks-cube
14
+ ```
15
+
16
+ Install the required packages:
17
+
18
+ ``` bash
19
+ pip install -r requirements.txt
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ To use the utility, import the ` Cube ` class from the ` cube ` module:
25
+
26
+ ``` python
27
+ from cube import Cube
28
+ ```
29
+
30
+ Create a new instance of the ` Cube ` class:
31
+
32
+ ``` python
33
+ cube = Cube()
34
+ ```
35
+
36
+ Print or plot the cube:
37
+
38
+ ``` python
39
+ cube.pprint()
40
+
41
+ # or
42
+
43
+ cube.plot()
44
+ ```
45
+
46
+ Perform a sequence of moves:
47
+
48
+ ``` python
49
+ cube.move(" R U R' U'" )
50
+ ```
51
+
52
+ Solver the cube using Layer by Layer (LBL) method:
53
+
54
+ ``` python
55
+ from solvers.layer_by_layer import LayerByLayerSolver
56
+
57
+ solver = LayerByLayerSolver(cube)
58
+ solver.solve()
59
+
60
+ print (solver.moves)
61
+ ```
62
+
63
+ Optimize the sequence of moves:
64
+
65
+ ``` python
66
+ from solvers.optimizer import optimize_moves
67
+
68
+ print (len (moves))
69
+ moves = optimize_moves(moves)
70
+ print (len (moves))
71
+ ```
72
+
73
+ ## Misc
74
+
75
+ To use a custom VisualCube server, set the ` VISUAL_CUBE_HOST ` environment variable:
76
+
77
+ ``` bash
78
+ export VISUAL_CUBE_HOST=" http://localhost:80"
79
+ ```
80
+
81
+
82
+
83
+
84
+
85
+
86
+
You can’t perform that action at this time.
0 commit comments