OpenAI Gym environments for various twisty puzzles
Project description
RubiksCubeGym
An OpenAI Gym environment for various twisty puzzles.
Currently available environments:
- 2x2x2 Pocket Rubik's Cube
- Pyraminx
- Skewb
Citation
@article{hukmani2021solving,
title={Solving Twisty Puzzles Using Parallel Q-learning.},
author={Hukmani, Kavish and Kolekar, Sucheta and Vobugari, Sreekumar},
journal={Engineering Letters},
volume={29},
number={4},
year={2021}
}
Details:
2x2x2 Pocket Rubik's Cube
| Action Space | Discrete(3) |
| Observation Space | Discrete(3674160) |
| Actions | F, R, U |
| Rewards | (-inf, 100] |
| Max steps | 250 |
| Reward Types | Base, Layer By Layer Method, Ortega Method |
| Render Modes | 'human', 'rgb_array', 'ansi' |
Pyraminx without tips
| Action Space | Discrete(4) |
| Observation Space | Discrete(933120) |
| Actions | L, R, U, B |
| Rewards | (-inf, 100] |
| Max steps | 250 |
| Reward Types | Base, Layer by Layer Method |
| Render Modes | 'human', 'rgb_array', 'ansi' |
Skewb
| Action Space | Discrete(4) |
| Observation Space | Discrete(3149280) |
| Actions | L, R, U, B |
| Rewards | (-inf, 100] |
| Max steps | 250 |
| Reward Types | Base, Sarah's Method(Advanced) |
| Render Modes | 'human', 'rgb_array', 'ansi' |
Installation
Via PyPI
pip install rubiks-cube-gym
Or build from source
git clone https://github.com/DoubleGremlin181/RubiksCubeGym.git
cd RubiksCubeGym
pip install -e .
Requirements
- gym
- numpy
- opencv-python
- wget
Scrambling
You can pass the scramble as a parameter for the reset function
self.reset(scramble="R U R' U'")
The scramble should follow the WCA Notation
Example
import gym
import rubiks_cube_gym
env = gym.make('rubiks-cube-222-lbl-v0')
env.reset(scramble="R U R' U' R' F R2 U' R' U' R U R' F'")
for _ in range(4):
env.render()
print(env.step(1))
env.render(render_time=0)
env.close()
(3178426, -26, False, {'cube': array([ 0, 9, 2, 15, 4, 5, 6, 21, 16, 10, 1, 11, 12, 13, 14, 23, 17, 7, 3, 19, 20, 18, 22, 8], dtype=uint8), 'cube_reduced': 'WRWGOOGYRBWBOOGYRGWBYBYR'})
(1542962, -1, False, {'cube': array([ 0, 21, 2, 23, 4, 5, 6, 18, 17, 16, 15, 11, 12, 13, 14, 8, 7, 10, 9, 19, 20, 3, 22, 1], dtype=uint8), 'cube_reduced': 'WYWYOOGBRRGBOOGRGBRBYWYW'})
(1682970, -1, False, {'cube': array([ 0, 18, 2, 8, 4, 5, 6, 3, 7, 17, 23, 11, 12, 13, 14, 1, 10, 16, 21, 19, 20, 9, 22, 15], dtype=uint8), 'cube_reduced': 'WBWROOGWGRYBOOGWBRYBYRYG'})
(2220193, 25, False, {'cube': array([ 0, 3, 2, 1, 4, 5, 6, 9, 10, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], dtype=uint8), 'cube_reduced': 'WWWWOOGRBGRBOOGGRRBBYYYY'})
You can find my implementation and results using Parallel Q-learning here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rubiks_cube_gym-0.5.2.tar.gz.
File metadata
- Download URL: rubiks_cube_gym-0.5.2.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fedfde7dcd24c4c333342415648a4b87f3b94c6ac9096c2f3621930c526c08da
|
|
| MD5 |
eba7f8424110ea340c7124af2d0ad8b5
|
|
| BLAKE2b-256 |
6d3e5bccf8682617630b432574c9e087b6096e1a0f17fca8ce6ceebb48a496d3
|
File details
Details for the file rubiks_cube_gym-0.5.2-py3-none-any.whl.
File metadata
- Download URL: rubiks_cube_gym-0.5.2-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf04565afa3b6522141dd70f1be611a7767b994c4a51f27d3e44bd5f2d0961cc
|
|
| MD5 |
c952517f590cadd9043c7c9ecb7c14f8
|
|
| BLAKE2b-256 |
5c864c838482fe0d17237f327571d61c4cf78be19bf6e2fca92652d715c4babb
|