Skip to content

Commit b8867b1

Browse files
authored
Merge pull request #4 from Jtachan/release/v1.0.0
Release/v1.0.0
2 parents b346a7f + 1082d34 commit b8867b1

17 files changed

Lines changed: 1308 additions & 72 deletions
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v3
15-
- name: Set up Python 3.8
15+
- name: Set up Python 3.9
1616
uses: actions/setup-python@v4
1717
with:
18-
python-version: 3.8
18+
python-version: 3.9
1919

2020
- name: Install dependencies
2121
run: |
2222
python -m pip install --upgrade pip
23-
pip install -r dev_requirements.txt
23+
pip install flake8==6.0.* pylint==2.17.* black==23.7.0 isort==5.12.* pytest
2424
- name: Run linters
2525
run: |
26-
isort --check enigma_cipher setup.py unittests
27-
black --check enigma_cipher setup.py unittests
26+
isort --check src unittests
27+
black --check src unittests
2828
pip install .
29-
flake8 --tee --format=pylint enigma_cipher unittests
30-
pylint --rcfile=pylintrc enigma_cipher unittests
29+
flake8 --tee --format=pylint src unittests
30+
pylint --rcfile=pylintrc src unittests
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
16-
python-version: ["3.8", "3.9", "3.10", "3.11"]
16+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1717

1818
steps:
1919
- uses: actions/checkout@v3

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ dmypy.json
153153
cython_debug/
154154

155155
# PyCharm
156-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158-
# and can be added to the global gitignore or merged into this file. For a more nuclear
159-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160-
#.idea/
156+
.idea/
157+
158+
# Dev files
159+
check_pkg.bat
160+
dev_requirements.txt

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# package all files within the src directory
2+
graft src
3+
# exclude all bytecode files
4+
global-exclude *.py[cod]

README.md

Lines changed: 78 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,93 @@
1-
![tests_badge](https://github.com/Jtachan/{REPO}/actions/workflows/unittests.yml/badge.svg)
1+
![tests_badge](https://github.com/Jtachan/Rubik_sim/actions/workflows/unittests.yml/badge.svg)
22

3-
# Rubik's Cube Solver
3+
# Rubik Sim
44

5-
This project displays a Rubik's cube solver created with genetic algorithms.
5+
This project allows to simulate a 3x3 Rubik's cube and perform operations over it.
66

7-
## 📖 Documentation
8-
9-
Documentation will be added once the project advances.
10-
Feel free to look for the latest updates within the 'develop' branch.
11-
12-
## 🐍 Python Setup
7+
## ⚙️ Setup
138

149
**Requirements**
1510

16-
- Python 3.8 or higher
11+
- Python 3.9 or higher
1712

1813
**Installation**
1914

20-
The package is not released in PyPI. Thus, there are multiple options to run the code:
15+
The package is installable via pip:
2116

22-
1. Install via pip + git
2317
````shell
24-
pip install git+https://github.com/Jtachan/genetic_rubiks_solver.git
18+
pip install rubik-sim
2519
````
2620

27-
2. Clone the repo, then install locally
21+
Alternatively, the 'develop' branch can be installed for the latest changes
2822
```shell
29-
git clone https://github.com/Jtachan/genetic_rubiks_solver.git
30-
pip install .
23+
pip install git+https://github.com/Jtachan/genetic_rubiks_solver.git@develop
24+
```
25+
26+
## 🏃 Usage
27+
28+
#### Initializing the cube
29+
30+
The package allows importing all the classes directly from the module.
31+
32+
To initialize the cube, it is only needed the `RubiksCube` class.
33+
This generates a fully solved cube. To obtain a random state using `scramble()`
34+
35+
````python
36+
from rubik_sim import RubiksCube
37+
38+
my_cube = RubiksCube() # Solved cube
39+
my_cube.scramble() # Updates the cube by 25 random moves
40+
````
41+
42+
The number of moves to scramble the cube can also be specified as a parameter:
43+
<br/>`RubiksCube.scramble(nof_moves: int = 25)`
44+
45+
It is also possible to initialize any cube from a string of characters defining the color of each tile.
46+
47+
````python
48+
my_cube = RubiksCube.from_color_code(
49+
'BBBBBBBBBGGGGGGGGGOOOOOOOOOYYYYYYYYYRRRRRRRRRWWWWWWWWW'
50+
)
51+
````
52+
53+
The only supported colors are green ('G'), orange ('O'), yellow ('Y'), red ('R'), white ('W') and blue ('B').
54+
55+
#### Representation
56+
57+
The cube's state can be represented by calling `print()`
58+
59+
```pycon
60+
>>> print(my_cube)
61+
['B' 'B' 'B']
62+
['B' 'B' 'B']
63+
['B' 'B' 'B']
64+
['G' 'G' 'G']['O' 'O' 'O']['Y' 'Y' 'Y']['R' 'R' 'R']
65+
['G' 'G' 'G']['O' 'O' 'O']['Y' 'Y' 'Y']['R' 'R' 'R']
66+
['G' 'G' 'G']['O' 'O' 'O']['Y' 'Y' 'Y']['R' 'R' 'R']
67+
['W' 'W' 'W']
68+
['W' 'W' 'W']
69+
['W' 'W' 'W']
3170
```
71+
72+
From the representation, the faces are:
73+
74+
- Blue = Top (up) face
75+
- Green = Left face
76+
- Orange = Front face
77+
- Yellow = Right face
78+
- Red = Back face
79+
- White = Bottom (down) face
80+
81+
#### Rotating the cube
82+
83+
`RubiksCube.perform_operations(operations: Sequence[NOTATION_MOVES])`
84+
85+
This method updates the current state of the cube by performing operations over it.
86+
The supported operations are:
87+
> U, U', U2, D, D', D2, R, R', R2, L, L', L2, F, F', F2, B, B', B2,
88+
> M, M', M2, E, E', E2, S, S' and S2.
89+
90+
These are the general notations for the possible moves on the cube.
91+
More about the Rubik's cube notation: https://ruwix.com/the-rubiks-cube/notation/
92+
93+
Any missing notation can be performed with the current notations.

check_pkg.bat

Lines changed: 0 additions & 6 deletions
This file was deleted.

dev_requirements.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

gh_actions/enable_gh_actions

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)