Skip to content

Instantly share code, notes, and snippets.

@MrNice
Created March 11, 2014 03:36
Show Gist options
  • Save MrNice/9479039 to your computer and use it in GitHub Desktop.
Save MrNice/9479039 to your computer and use it in GitHub Desktop.
Cycle function for sliderSolve
var cycle = function(moveArray, times, direction) {
var i,
j,
length;
times = times || 1;
direction = direction || 'cw';
for( i = 0 ; i < times; i++ ) {
var copy = moveArray.slice();
for( j = 0; j < moveArray.length; j++) {
if(direction === 'ccw') {
move(copy.pop());
} else {
move(copy.shift());
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment