Rubik's cube solver in javascript