GithubHelp home page GithubHelp logo

dlin's Introduction

dlin

Describe piece cycles on a Rubik's Cube.

Installing

To install, run

pip install dlin

Usage: As a Python Package

The dlin.trace function converts a scramble (set of moves defined by WCA regulation 12a separated by spaces) into a python dictionary describing cycles on the cube.

To use, run

from dlin import trace

The following is example code to get the tracing for a scramble.

described_cycles = trace("F' L2 B2 F2 D' F2 D F2 U R2 U' L' B L' R' F2 R2 B2 U2 Fw'")

Here is an example of what could be contained in described_cycles

{
    "edge": [
        {
            "type": "cycle",
            "buffer": "UF",
            "targets": ["LD", "LF", "RU", "LU"],
            "orientation": 0,
            "parity": 0,
        },
        {
            "type": "cycle",
            "buffer": "UB",
            "targets": ["RB", "DR"],
            "orientation": 1,
            "parity": 0,
        },
        {
            "type": "cycle",
            "buffer": "FR",
            "targets": ["DB", "DF"],
            "orientation": 1,
            "parity": 0,
        },
    ],
    "corner": [
        {
            "type": "cycle",
            "buffer": "UFR",
            "targets": ["UBL", "RUB", "RDB", "FDR", "UFL", "FDL"],
            "orientation": 1,
            "parity": 0,
        },
        {
            "type": "misoriented",
            "buffer": "DBL",
            "targets": [],
            "orientation": -1,
            "parity": 0,
        },
    ],
    "scramble": "F' L2 B2 F2 D' F2 D F2 U R2 U' L' B L' R' F2 R2 B2 U2 Fw'",
    "rotation": ["z"],
}

Usage: Command Line Script

Run

dlin-trace [scramble]

Make sure to surround the scramble in quotation marks. This will output a json, with similar structure to the dictionary shown above.

dlin's People

Contributors

elliottkobelansky avatar rpfarish avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

rpfarish eklaman

dlin's Issues

README.md specifies incorrect usage for trace (maybe just a typo)

I was testing out the module and tried to have it trace a scramble. However, when I tried it out with the recommended usage with
"from dlin import tracer" and "described_cycles = tracer("F' L2 B2 F2 D' F2 D F2 U R2 U' L' B L' R' F2 R2 B2 U2 Fw'")" this was the result:
"Traceback (most recent call last): File "", line 1, in TypeError: 'module' object is not callable."

So, I think that "tracer" is a module and not a function, so it is not callable. I did find however that the function "trace" which was instantiated in dlin/init.py and is assumedly the intended object to call.
I think then that this is what you meant instead:
from dlin import trace
described_cycles = trace("F' L2 B2 F2 D' F2 D F2 U R2 U' L' B L' R' F2 R2 B2 U2 Fw'")

Unless semantically speaking you like the name "tracer" better but this is how I got it to work.
Also, calling "dlin-trace [scramble]" works fine for me

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.