Code Monkey home page Code Monkey logo

scrambo's Introduction

Build Status

Scrambo - Puzzle Scramble Generator

scrambo

Usage

// Generate a new 4x4 scramble with the seed of 1
var seeded_scramble = new Scrambo().type('444').seed(1).get();
console.log(seeded_scramble);

// Generate 5 scrambles (defaults to 3x3)
var multiple_scrambles = new Scrambo().get(5);
console.log(multiple_scrambles);

Cli

npm install -g scrambo
scrambo

Node.js

npm install scrambo
var Scrambo = require('scrambo');

var threebythree = new Scrambo(); // Defaults to 3x3
console.log(threebythree.get(5)); // Returns 5 scrambles

Browser

<script src="scrambo.js"></script>

<script>
  var threebythree = new Scrambo(); // Defaults to 3x3
  console.log(threebythree.get(5)); // Returns 5 scrambles
</script>

API

.get(num); // Returns a number of scrambles, defaults to 1.
.type(str); // Sets the scramble type, defaults to 333.
.seed(num); // Repeatable scrambles.
.length(num); // Set scramble length, currently only for NNN, minx scrambles.

Current status

Alpha, but works!

Credits

This is a fork of jsss

scrambo's People

Contributors

nickcolley avatar gyroninja avatar coder13 avatar timhabermaas avatar

Stargazers

 avatar Cohen Erickson avatar kotborealis avatar Imaad Zaffar avatar Dominik avatar Jonathan Noriega avatar Tushar Singh Jamwal avatar Arvid Sollenby avatar biohuns avatar Jesper Hasselquist avatar Michael Corrado avatar Thomas Rasmussen avatar Mauro Nava Luevanos avatar Ved Topkar avatar Toan Tran avatar Mihir Chaturvedi avatar Koki Takahashi avatar Jason avatar Vova Hayrapetyan avatar Zuqi Chen avatar Jim Schmid avatar  avatar  avatar Siddharth Kannan avatar z avatar Justin Jaffray avatar

scrambo's Issues

Update README

Update README with relevant information, make sure to give fork credits to JSSS

Tests

Current test is just so there's a test, so we need to flesh it out properly.

Document contributions

When we get the backend scrambles into something slightly more abstract document how to add puzzles.

Scramblers are non-idomatic and unnecessarly cryptic

Since most of the scramblers have been ported form a different language there's a lot of patterns that are not very idiomatic of JavaScript.

Also we have a ton of code that is using single variables etc so it's impossible to know what's going on.

Not sure how to deal with that since I don't know enough about cube theory, maybe someone else could help there.

Remove unused code from new adapters

New 222 and 333 adapters have code to render cubes but we only care about scrambles in this project.

This will make the payload smaller and remove more responsibility away from this repo, if these are needed they should be put into a different library.

You can run 'npm run cover' to get a coverage report which should help in finding dead code.

type('222') returns '333' scramble

It appears that the 2x2 scramble is a 3x3 scramble. In my example below they both return a similar-length scramble. The 2x2 should be shorter?

const cube3x3 = new Scrambo().type('333').seed(22223).get(1);
console.log(cube3x3);

returns: L2 U L2 B R' B' D F' D2 F2 U B2 U B R D L' U2 R' F

const cube2x2 = new Scrambo().type('222').seed(22223).get(1);
console.log(cube2x2;)

returns: F' R' U F2 R' U2 F' R U2 R' U' R F' U R2 F2 U' R' F' U'

object Object

   } else if(message.content === "_4") {
     var seeded_scramble = new Scrambow().setType('444').setSeed(1).get();
     message.channel.send(seeded_scramble)

when i use the command it returns [object Object] why

6x6 and 7x7 scrambles don't have 3w moves

As title says. Running a 6x6 or 7x7 scramble will use the same moveset as a 4x4 or 5x5 scramble. Fixing this may mean switching to different wide move notation (eg "Rw2" rather than "r2"), so that "3Rw2" can be nicely implemented?

Edit: This issue is fixed in Owstin's Pull Request

Get 3x3.js and 2x2.js working

Not sure what the purpose of these are if we can generate those scrambles with NNN.js but they fail the tests currently.

A more functional api

I really don't like the current API (wrote it a while ago).

I'd prefer something more functional, the current implementation holds state which I'd want to avoid.

It'd probably by nicer to keep it simple and pass an option object.

Maybe the current state features could be solved by currying?

Expose drawScramble

It would be nice if we could use the respective drawScramble() functions for each scrambler.

Scramblers should be immutable, or obviously mutable

As discussed:

var scrambler = new Scrambo();
var four = scrambler.type("4x4");
var five = scrambler.type("5x5");

Doesn't work as expected, since the notation kind of reads like an immutable chain, but .type is actually a setter on a Scrambo.

Some things I would prefer:

  • have .type return a new Scrambo with the appropriate scrambler type
  • move the specification of the type into the constructor: new Scrambo("4x4") or new Scrambo({ type: "4x4" })
  • rename type to setType and getType

Make .length immutable

Senario: Random seeded scramble and you want to change the length.
Currently this'd only be possible with a defined seed as it'd regenerate it.
We could do length without damaging the output seed?

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.