Coder Social home page Coder Social logo

cubing / twisty.js Goto Github PK

View Code? Open in Web Editor NEW
60.0 9.0 15.0 2.25 MB

The functionality of `twisty.js` is now part of `cubing.js`. Please see: https://js.cubing.net/cubing/twisty/

License: GNU General Public License v3.0

JavaScript 2.63% HTML 5.05% Makefile 1.11% TypeScript 78.95% CSS 12.27%
cubing javacript library

twisty.js's People

Contributors

hakatashi avatar jfly avatar lgarron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twisty.js's Issues

Twistypuzzle Standards

Basically, an RFC process for (twisty)puzzles/speedcubing. I've had plans for this one since a really long while, but the Regs got in the way.

  • Notation:
    • SiGN
    • Various puzzles
    • General "SiGN" template for new puzzles.
      • Specifies grammar for repetitions, inverses, grouping, commutators, conjugates.
        • Context-free (no macros!).
        • As self-delimiting as possible. This helps make white space as irrelevant as possible, and parsing more reliable for humans/computers. (But I expect we will always have to handle something like R 2L !== R2 L, since a lot of thinking has never led to something else that is flexible and concise in most situations.).
    • General JSON/recursive-object-oriented representation format of algs.
      • For example, python lists and dicts can handle the internal JSON representation from twisty.js with a trivial translation. Java/C++ could handle these with only a few definitions, but that requires handling weird things like (implicit and explicit) slice specifications for big puzzles.
  • Puzzle serialization formats.

Move the main repo to github.com/cubing

Then have all devs (e.g. Lucas and Jeremy for now) review each other's code changes before merging pull requests.

I had planned to do this once I got the MVC for this in order (e.g. making it easy to use twisty.js in many different ways), but Jeremy leaped in too early. :-P

Default Repeatable amount to 1

If this uses an optional argument (rather than an option object), then we need to be careful about the interaction between this and #74 lest we create another JSON.stringify second arg.

Show sticker hints

Like AnimCube. This takes about 10 lines, and looks pretty nice. I didn't commit it because I need to handle single vs. double-sided textures better for that.

Remove jQuery dependency

It's not really needed. In alg.cubing.net, Angular can handle most of the interactivity itself.

Puzzle description contract

  • parameters per puzzle
  • key handlers
    • variable states? (level of slice for big cubes [visual indicator of those?])
  • initmove/revmove stuff?
  • visual options (stickers + cubies, stickers only, etc.)
  • Random move / alg generation?

Group Theory

  • Calculate the order of an alg.
  • Handle permutation representations of puzzles
  • Fast calculation of a position.
    • Even inside many nested commutators/conjugates/repetitions.

Structural alg traversal

Many alg operations can be supported on "unflattened" algs (i.e. commutators and conjugates unexpanded).

  • Move count.
  • Total animation time (given time for each move token).
  • Puzzle state at a given position.
    • See #46.
    • There's no reason we shouldn't be able to support algs with arbitrarily many moves (millions? trillions?), as long as the nested representation is concise.

It should be simple to write something to do this in general. It just requires something that can handle JSON traversal given handlers for the following nodes:

  • basic moves
  • groupings
  • commutators
  • conjugates

Rounded stickers

If I'm in charge of rendering cubes, they're going to look pretty, Gauss fix it with a needle.

Packaged version.

Eventually, everything should be turned into a single include file with simple usage.

Also see #27 .

Proper translation between JSON algs and alg strings.

I started this a while ago (still uncommitted), but this needs to be done carefully some time. It needs to incorporate things like commutator and comment parsing, and the ability to make text displays of algs correspond to animations.

Alg equality checking.

Allows simplifying [R, U] [R, U] to [R, U]2

Question: is (R U) R == R (U R) ?
(While simplifying, I think it should. But structurally, it's unclear.)

License

Having an open-source license on this would be great, since I'd really like to make use of it.

Lenient parsing modes

  • Incorrect characters (orior maybe-instead of'`)
  • Just ignore any unfixable line? (i.e. assume it's a comment?)
  • Alternate capitalization/move names (e.g. Y instead of y).
  • WCA bracketed rotations

I actually think most of these are not good ideas, but it's a thought.

Time-based Animation

Right now, the animation is frame-based, which slows down when the browser does. It seems reasonable to compensate for the framerate by using interpolated time to update the progress of an animation.

Bugs and Features

  • Animate based on time, not steps
  • Update speed before move (reproduce: queue lots of moves; after they're done, the next move is instant, the one after that normal).
    • Rethink speed control in general.
  • Negative layer indices
  • Proper drag/touch support (#9)

Cubies

i.e. the internal plastic. Works, but still not perfect.

Don't allow repeats for pauses?

R.2L is parsed as R .2 L. It's probably better to forbid repetitions/inverses on raw pauses. Repeating dots are a beautiful alternative: R...L

Puzzle/State representation

  • Current state (array of (piece + matrix))
  • tempo function for each possible ongoing move
  • Queueing moves
  • Move pause
  • Speed up if queue grows (inc. current move straight into next)
  • Simultaneous moves
  • Metric support?
  • Algorithm objects?

Bookmarklet

The design should definitely be aiming to support this.

(Highlight text on a page, click bookmarklet to view animation. This can then easily be adapted for speedsolving.com)

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.