Spaces:
Sleeping
Sleeping
File size: 3,569 Bytes
58ae89c b76d8b7 58ae89c bf0b4f6 b76d8b7 feff440 58ae89c feff440 50751c0 1815be7 27be29d 58ae89c a6517cd 50751c0 58ae89c feff440 580f78c f12b6ac 50751c0 a478bce 2b992b5 a478bce f12b6ac 1cbab28 f12b6ac a478bce 1cbab28 f12b6ac 1cbab28 580f78c f12b6ac 580f78c f12b6ac 580f78c feff440 ea09e61 65c278c ea09e61 b24b865 ea09e61 f12b6ac a6517cd 27be29d a6517cd 27be29d 5457ec8 a6517cd 5457ec8 a6517cd 5457ec8 a6517cd 27be29d f12b6ac |
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
---
title: Rubik Tensor
emoji: ⚡
colorFrom: blue
colorTo: blue
sdk: docker
pinned: true
license: apache-2.0
short_description: Interface for playing with Rubik cubes of any size
---
# Rubik-Tensor
See the HF Space [JBAujogue/Rubik-Tensor](https://huggingface.co/spaces/JBAujogue/Rubik-Tensor) (make sure to accept 3rd-party cookies through the `Eye` icon of the URL bar).
## Setup
This project uses `uv 0.8.3` as environment & dependency manager, and `python 3.11` as core interpreter. Install the project with
```shell
uv venv
(Activate env)
uv sync --extra [extra]
pre-commit install
```
where `extra` should be one of the following:
- `torch`: pytorch package released on pypi (cpu-only form non-linux systems, cuda-enabled for linux systems).
- `torch-cpu`: cpu-only torch wheel.
- `torch-cu126`: cuda 12.6-compatible torch wheel.
## Usage
### Launch the web interface
```shell
python -m rubik interface
```
### Use the python API
```python
from rubik.cube import Cube
cube = Cube(size=3)
# display cube state
print(cube)
# UUU
# UUU
# UUU
# LLL CCC RRR BBB
# LLL CCC RRR BBB
# LLL CCC RRR BBB
# DDD
# DDD
# DDD
# display history of moves
print(cube.history)
# []
# scramble the cube using 1000 random moves (this resets the history)
cube.scramble(num_moves=1000, seed=0)
# rotate it in some way (this gets appended to history)
cube.rotate('X2 X1i Y1i Z1i Y0 Z0i X2 X1i Y1i Z1i Y0 Z0i')
```
## Roadmap
#### Fully tensorized Rubik Cube model
- ☑️ Tensorized states.
- ☑️ Tensorized actions.
- ☑️ Interface for performing actions.
#### Movement explorer
- ⬜ Explore changes resulting from a sequences of moves.
- ⬜ Find least sequences of moves satisfying some input constrains.
#### Visualization interface
#### Base solvers following rule-based policies
## References
### Implementations & rule-based solvers
Open-source projects related to Rubik's Cube:
- [adrianliaw/PyCuber](https://github.com/adrianliaw/PyCuber)
- [pglass/cube](https://github.com/pglass/cube)
- [dwalton76/rubiks-cube-NxNxN-solver](https://github.com/dwalton76/rubiks-cube-NxNxN-solver)
- [bellerb/RubiksCube_Solver](https://github.com/bellerb/RubiksCube_Solver)
- [trincaog/magiccube](https://github.com/trincaog/magiccube)
- [charlstown/rubiks-cube-solver](https://github.com/charlstown/rubiks-cube-solver)
- [staetyk/NxNxN-Cubes](https://github.com/staetyk/NxNxN-Cubes)
- [wata-orz/santa2023_permutation_puzzle](https://github.com/wata-orz/santa2023_permutation_puzzle/tree/main)
### Machine Learning based solver models
- 2025, _CayleyPy Cube_, [Github](https://github.com/k1242/cayleypy-cube), [Paper](https://arxiv.org/html/2502.13266v1)
- 2025, _Solving A Rubik’s Cube with Supervised Learning – Intuitively and Exhaustively Explained_, [Blog post](https://towardsdatascience.com/solving-a-rubiks-cube-with-supervised-learning-intuitively-and-exhaustively-explained-4f87b72ba1e2/)
- 2024, _Solving Rubik's Cube Without Tricky Sampling_, [Paper](https://arxiv.org/abs/2411.19583).<br>
This involves training a scorer, that estimates the number of moves transforming a given source state into a given target state, where the latter is not necessarily a solved cube. Data are synthetically generated performing random moves and factorizing repeated identical moves.
- 2023, _Curious Transformer_, [Github](https://github.com/tedtedtedtedtedted/Solve-Rubiks-Cube-Via-Transformer)
- 2021, _Efficient Cube_, [Github](https://github.com/kyo-takano/efficientcube), [Paper](https://arxiv.org/abs/2106.03157)
|