Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
luckasRanarison committed Feb 22, 2024
0 parents commit bd73037
Show file tree
Hide file tree
Showing 23 changed files with 2,257 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --workspace --lib --verbose
- name: Lint
run: cargo clippy -- -D warnings
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
251 changes: 251 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[workspace]
members = ["three-style-lib", "three-style-cli"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 LIOKA Ranarison Fiderana

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# three-style

[![Build/test](https://github.com/luckasRanarison/three-style/actions/workflows/ci.yml/badge.svg)](https://github.com/luckasRanarison/three-style/actions/workflows/ci.yml)
[![crates.io](https://img.shields.io/crates/v/three-style)](https://crates.io/crates/three-style)

three-style is a program that searches 3x3 commutators used in 3-style, an advanced method for solving the Rubik's cube blindfolded by swapping 3 pieces at a time without affecting the rest of the cube.

## Contents

- [Installation](#installation)
- [Usage](#usage)
- [Concept](#concept)
- [References](#concept)
- [Contributing](#contributing)

## Installation

You can use three-style by downloading the prebuilt binary for your system from the [releases](https://github.com/luckasRanarison/three-style/releases) or by installing it using cargo:

```bash
cargo install three-style
```

## Usage

three-style uses layers for describing pieces or more precisely sticker targets. Example: `UF` (edge), `UBL` (corner). Currently, it only exposes one main command `search` and is used in the following way:

```bash
three-style search --gen RUD --corners UFR UBL RFD --depth 4
three-style search -g RUD -c UFR UBL RFD -d 4
three-style search --gen RUE --edges UF UB LF --depth 4
three-style search -g RUD -e UF UB LF -d 4
```

> [!NOTE]
> Depth is relative to the length of the commutator in its notation form.
## Concept

A commutator is an algorithm of the form: `A B A' B'` which allows us to swap 3 pieces at once without affecting the rest of the cube. It's commonly described in the following notation: `[A, B]`.

It consists of two basic parts:

- An **interchange** is a single move that swaps two pieces without affecting the third one
- An **insertion** are three moves that insert the third piece into one of the two pieces spot without affecting the other one.

But not all cases can be solved using pure commutators, some cases require using setup moves. A **setup move** is a sequence of moves that turn the case into a case that can be solved using pure commutators. Commutators that use setup moves are of the form `S A B A' B' S'` and are more commonly written as `[S: [A, B]]`

> [!NOTE]
> Edges has a special case called **4 movers** which don't use the normal 3 moves insertion. Example: `[M', U2]`
The program basically does an interative DFS and applies these rules to find commutators. Because these rules allow efficient prunning, search is decently fast.

## References

- [3-style tutorial by Timothy Goh](https://youtu.be/Bq9oz1k5wP4?si=fC3Xi_7j0ehMaepG)

- [Cube explorer](http://kociemba.org/cube.htm)

## Contributing

Bug reports, Pull requests and feature requests are all welcome!
15 changes: 15 additions & 0 deletions three-style-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "three-style"
version = "0.1.0"
edition = "2021"
description = "A CLI tool for searching 3x3 Rubiks'cube 3-style commutators"
authors = ["LIOKA Ranraison Fiderana <[email protected]>"]
repository = "https://github.com/luckasRanarison/three-style"
keywords = ["rubiks-cube", "three-style", "commutators", "algorithms"]
categories = ["algorithms"]
license = "MIT"
readme = "../README.md"

[dependencies]
three-style-lib = { path = "../three-style-lib" }
clap = { version = "4.5.1", features = ["derive", "color"] }
Loading

0 comments on commit bd73037

Please sign in to comment.