cube-python 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cube_python-0.4.0/LICENSE +20 -0
- cube_python-0.4.0/PKG-INFO +88 -0
- cube_python-0.4.0/README.md +69 -0
- cube_python-0.4.0/cube_python.egg-info/PKG-INFO +88 -0
- cube_python-0.4.0/cube_python.egg-info/SOURCES.txt +14 -0
- cube_python-0.4.0/cube_python.egg-info/dependency_links.txt +1 -0
- cube_python-0.4.0/cube_python.egg-info/top_level.txt +1 -0
- cube_python-0.4.0/cxx/cube_amalg.min.cpp +1665 -0
- cube_python-0.4.0/pycube/__init__.py +51 -0
- cube_python-0.4.0/pycube/_exceptions.py +20 -0
- cube_python-0.4.0/pycube/_ffi.py +53 -0
- cube_python-0.4.0/pyproject.toml +36 -0
- cube_python-0.4.0/setup.cfg +4 -0
- cube_python-0.4.0/setup.py +32 -0
- cube_python-0.4.0/test/test.2.py +21 -0
- cube_python-0.4.0/test/test_cube.py +30 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2026 coshz
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included
|
|
12
|
+
in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cube-python
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Python binding for Cube C++ library
|
|
5
|
+
Author-email: coshz <fsinhx@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Documentation, https://github.com/coshz/cube/tree/master/bindings/python#readme
|
|
8
|
+
Project-URL: Source, https://github.com/coshz/cube
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/coshz/cube/issues
|
|
10
|
+
Keywords: game,rubiks-cube,bindings
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: C++
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# cube-python
|
|
21
|
+
|
|
22
|
+
[](https://pypi.org/project/cube-python/)
|
|
23
|
+
[](https://github.com/yourusername/cube/blob/main/LICENSE)
|
|
24
|
+
[](https://github.com/coshz/cube/tree/master/bindings/python)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
High-performance Rubik's Cube solver Python bindings powered by C/C++ FFI.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install cube-python
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quickstart
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
iimport pycube
|
|
41
|
+
from pycube import SolveError
|
|
42
|
+
|
|
43
|
+
# Default solved cube string representation
|
|
44
|
+
print(f"Target State: {pycube.CUBE_ID}")
|
|
45
|
+
|
|
46
|
+
# Validate state solvability
|
|
47
|
+
scrambled = pycube.facecube("U F U' L2 R L' D2 B")
|
|
48
|
+
|
|
49
|
+
if pycube.solvable(scrambled):
|
|
50
|
+
try:
|
|
51
|
+
# Find solution sequence
|
|
52
|
+
solution = pycube.solve(scrambled, step=30, best=True)
|
|
53
|
+
print(f"Solution: {solution}")
|
|
54
|
+
|
|
55
|
+
# Apply solution to verify end state
|
|
56
|
+
end_state = pycube.facecube(solution, scrambled)
|
|
57
|
+
assert end_state == pycube.CUBE_ID
|
|
58
|
+
|
|
59
|
+
except SolveError as e:
|
|
60
|
+
print(f"Failed to solve cube: {e}")
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 📖 API Reference
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
import pycube
|
|
67
|
+
from pycube import SolveError, CUBE_ID
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Functions
|
|
71
|
+
|
|
72
|
+
| Function | Description |
|
|
73
|
+
| :--- | :--- |
|
|
74
|
+
| `solve(src, tgt=CUBE_ID, step=30, best=False)` | Solves the cube state string `src`. Returns solution string or raises `SolveError`. |
|
|
75
|
+
| `facecube(maneuver, cube=CUBE_ID)` | Applies move sequence (e.g., `"U F U' L2"`) to a cube state and returns the new state. |
|
|
76
|
+
| `solvable(cube)` | Returns `True` if the 54-character state string is physically solvable. |
|
|
77
|
+
| `permutation(ms, fmt=2)` | Returns a permutation representation for a move sequence or state. |
|
|
78
|
+
|
|
79
|
+
### Constants & Exceptions
|
|
80
|
+
|
|
81
|
+
| Name | Type | Description |
|
|
82
|
+
| :--- | :--- | :--- |
|
|
83
|
+
| `CUBE_ID` | `str` | Constant representing the standard solved state (`"UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB"`). |
|
|
84
|
+
| `SolveError` | `Exception` | Raised when the state is invalid, unsolvable, or exceeds search step limits. |
|
|
85
|
+
|
|
86
|
+
## 📄 License
|
|
87
|
+
|
|
88
|
+
[MIT](LICENSE) © coshz
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# cube-python
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/cube-python/)
|
|
4
|
+
[](https://github.com/yourusername/cube/blob/main/LICENSE)
|
|
5
|
+
[](https://github.com/coshz/cube/tree/master/bindings/python)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
High-performance Rubik's Cube solver Python bindings powered by C/C++ FFI.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install cube-python
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quickstart
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
iimport pycube
|
|
22
|
+
from pycube import SolveError
|
|
23
|
+
|
|
24
|
+
# Default solved cube string representation
|
|
25
|
+
print(f"Target State: {pycube.CUBE_ID}")
|
|
26
|
+
|
|
27
|
+
# Validate state solvability
|
|
28
|
+
scrambled = pycube.facecube("U F U' L2 R L' D2 B")
|
|
29
|
+
|
|
30
|
+
if pycube.solvable(scrambled):
|
|
31
|
+
try:
|
|
32
|
+
# Find solution sequence
|
|
33
|
+
solution = pycube.solve(scrambled, step=30, best=True)
|
|
34
|
+
print(f"Solution: {solution}")
|
|
35
|
+
|
|
36
|
+
# Apply solution to verify end state
|
|
37
|
+
end_state = pycube.facecube(solution, scrambled)
|
|
38
|
+
assert end_state == pycube.CUBE_ID
|
|
39
|
+
|
|
40
|
+
except SolveError as e:
|
|
41
|
+
print(f"Failed to solve cube: {e}")
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 📖 API Reference
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import pycube
|
|
48
|
+
from pycube import SolveError, CUBE_ID
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Functions
|
|
52
|
+
|
|
53
|
+
| Function | Description |
|
|
54
|
+
| :--- | :--- |
|
|
55
|
+
| `solve(src, tgt=CUBE_ID, step=30, best=False)` | Solves the cube state string `src`. Returns solution string or raises `SolveError`. |
|
|
56
|
+
| `facecube(maneuver, cube=CUBE_ID)` | Applies move sequence (e.g., `"U F U' L2"`) to a cube state and returns the new state. |
|
|
57
|
+
| `solvable(cube)` | Returns `True` if the 54-character state string is physically solvable. |
|
|
58
|
+
| `permutation(ms, fmt=2)` | Returns a permutation representation for a move sequence or state. |
|
|
59
|
+
|
|
60
|
+
### Constants & Exceptions
|
|
61
|
+
|
|
62
|
+
| Name | Type | Description |
|
|
63
|
+
| :--- | :--- | :--- |
|
|
64
|
+
| `CUBE_ID` | `str` | Constant representing the standard solved state (`"UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB"`). |
|
|
65
|
+
| `SolveError` | `Exception` | Raised when the state is invalid, unsolvable, or exceeds search step limits. |
|
|
66
|
+
|
|
67
|
+
## 📄 License
|
|
68
|
+
|
|
69
|
+
[MIT](LICENSE) © coshz
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cube-python
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Python binding for Cube C++ library
|
|
5
|
+
Author-email: coshz <fsinhx@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Documentation, https://github.com/coshz/cube/tree/master/bindings/python#readme
|
|
8
|
+
Project-URL: Source, https://github.com/coshz/cube
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/coshz/cube/issues
|
|
10
|
+
Keywords: game,rubiks-cube,bindings
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: C++
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# cube-python
|
|
21
|
+
|
|
22
|
+
[](https://pypi.org/project/cube-python/)
|
|
23
|
+
[](https://github.com/yourusername/cube/blob/main/LICENSE)
|
|
24
|
+
[](https://github.com/coshz/cube/tree/master/bindings/python)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
High-performance Rubik's Cube solver Python bindings powered by C/C++ FFI.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install cube-python
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Quickstart
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
iimport pycube
|
|
41
|
+
from pycube import SolveError
|
|
42
|
+
|
|
43
|
+
# Default solved cube string representation
|
|
44
|
+
print(f"Target State: {pycube.CUBE_ID}")
|
|
45
|
+
|
|
46
|
+
# Validate state solvability
|
|
47
|
+
scrambled = pycube.facecube("U F U' L2 R L' D2 B")
|
|
48
|
+
|
|
49
|
+
if pycube.solvable(scrambled):
|
|
50
|
+
try:
|
|
51
|
+
# Find solution sequence
|
|
52
|
+
solution = pycube.solve(scrambled, step=30, best=True)
|
|
53
|
+
print(f"Solution: {solution}")
|
|
54
|
+
|
|
55
|
+
# Apply solution to verify end state
|
|
56
|
+
end_state = pycube.facecube(solution, scrambled)
|
|
57
|
+
assert end_state == pycube.CUBE_ID
|
|
58
|
+
|
|
59
|
+
except SolveError as e:
|
|
60
|
+
print(f"Failed to solve cube: {e}")
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 📖 API Reference
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
import pycube
|
|
67
|
+
from pycube import SolveError, CUBE_ID
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Functions
|
|
71
|
+
|
|
72
|
+
| Function | Description |
|
|
73
|
+
| :--- | :--- |
|
|
74
|
+
| `solve(src, tgt=CUBE_ID, step=30, best=False)` | Solves the cube state string `src`. Returns solution string or raises `SolveError`. |
|
|
75
|
+
| `facecube(maneuver, cube=CUBE_ID)` | Applies move sequence (e.g., `"U F U' L2"`) to a cube state and returns the new state. |
|
|
76
|
+
| `solvable(cube)` | Returns `True` if the 54-character state string is physically solvable. |
|
|
77
|
+
| `permutation(ms, fmt=2)` | Returns a permutation representation for a move sequence or state. |
|
|
78
|
+
|
|
79
|
+
### Constants & Exceptions
|
|
80
|
+
|
|
81
|
+
| Name | Type | Description |
|
|
82
|
+
| :--- | :--- | :--- |
|
|
83
|
+
| `CUBE_ID` | `str` | Constant representing the standard solved state (`"UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB"`). |
|
|
84
|
+
| `SolveError` | `Exception` | Raised when the state is invalid, unsolvable, or exceeds search step limits. |
|
|
85
|
+
|
|
86
|
+
## 📄 License
|
|
87
|
+
|
|
88
|
+
[MIT](LICENSE) © coshz
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
cube_python.egg-info/PKG-INFO
|
|
6
|
+
cube_python.egg-info/SOURCES.txt
|
|
7
|
+
cube_python.egg-info/dependency_links.txt
|
|
8
|
+
cube_python.egg-info/top_level.txt
|
|
9
|
+
cxx/cube_amalg.min.cpp
|
|
10
|
+
pycube/__init__.py
|
|
11
|
+
pycube/_exceptions.py
|
|
12
|
+
pycube/_ffi.py
|
|
13
|
+
test/test.2.py
|
|
14
|
+
test/test_cube.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pycube
|