Implementation of Rubik's Cube Formula in PyCuber

72
RUBIK'S CUBE FORMULA IN PYCUBER Adrian Liaw

Transcript of Implementation of Rubik's Cube Formula in PyCuber

Page 1: Implementation of Rubik's Cube Formula in PyCuber

RUBIK'S CUBEFORMULA IN PYCUBER

Adrian Liaw

Page 2: Implementation of Rubik's Cube Formula in PyCuber

http://bit.ly/1QdarwT

Page 3: Implementation of Rubik's Cube Formula in PyCuber

ABOUT MEJunior high school studentHome-schooling"Learning Reinforcer" at Agilearning

Page 4: Implementation of Rubik's Cube Formula in PyCuber

OTHER INTERESTSClassical Piano

Page 5: Implementation of Rubik's Cube Formula in PyCuber

AGENDAWhy / What's PyCuberSeveral Parts in PyCuberRubik's Cube (And Notations)ImplementationsThings About Rubik's Cube

Page 6: Implementation of Rubik's Cube Formula in PyCuber

JUST FOR FUN

Page 7: Implementation of Rubik's Cube Formula in PyCuber

IMPLEMENT PARTS INPYCUBER

Page 8: Implementation of Rubik's Cube Formula in PyCuber

cube.pyformula.pysolver/

Page 9: Implementation of Rubik's Cube Formula in PyCuber

RUBIK'S CUBE

Page 10: Implementation of Rubik's Cube Formula in PyCuber

ERNŐ RUBIK

Page 11: Implementation of Rubik's Cube Formula in PyCuber

RUBIK'S CUBE

Page 12: Implementation of Rubik's Cube Formula in PyCuber

RUBIK'S REVENGE

Page 13: Implementation of Rubik's Cube Formula in PyCuber

PROFESSOR'S CUBE

Page 14: Implementation of Rubik's Cube Formula in PyCuber

OVER THE TOP

Page 15: Implementation of Rubik's Cube Formula in PyCuber

POCKET CUBE

Page 16: Implementation of Rubik's Cube Formula in PyCuber

...

Page 17: Implementation of Rubik's Cube Formula in PyCuber

NOTATIONS

Page 18: Implementation of Rubik's Cube Formula in PyCuber

SINGMASTER NOTATION

Page 19: Implementation of Rubik's Cube Formula in PyCuber

BASIC NOTATIONSR (right)L (left)U (up)B (bottom)F (front)B (back)

Page 20: Implementation of Rubik's Cube Formula in PyCuber

R

Page 21: Implementation of Rubik's Cube Formula in PyCuber

L

Page 22: Implementation of Rubik's Cube Formula in PyCuber

U

Page 23: Implementation of Rubik's Cube Formula in PyCuber

D

Page 24: Implementation of Rubik's Cube Formula in PyCuber

F

Page 25: Implementation of Rubik's Cube Formula in PyCuber

B

Page 26: Implementation of Rubik's Cube Formula in PyCuber

F'

Page 27: Implementation of Rubik's Cube Formula in PyCuber

U2

Page 28: Implementation of Rubik's Cube Formula in PyCuber

WIDE TURNS

Page 29: Implementation of Rubik's Cube Formula in PyCuber

r

Page 30: Implementation of Rubik's Cube Formula in PyCuber

l'

Page 31: Implementation of Rubik's Cube Formula in PyCuber

d2

Page 32: Implementation of Rubik's Cube Formula in PyCuber

WHOLE CUBEROTATIONS

Page 33: Implementation of Rubik's Cube Formula in PyCuber

x

Page 34: Implementation of Rubik's Cube Formula in PyCuber

y'

Page 35: Implementation of Rubik's Cube Formula in PyCuber

z2

Page 36: Implementation of Rubik's Cube Formula in PyCuber

IT'S TIME FOR SOME PYTHONIC STUFF

Page 37: Implementation of Rubik's Cube Formula in PyCuber

CLASSESStepFormula

Page 38: Implementation of Rubik's Cube Formula in PyCuber

STEPface (F, L, d, y)extra symbol (counter-clockwise, 180 degrees)

Page 39: Implementation of Rubik's Cube Formula in PyCuber

SEVERAL UTILITIES__add____mul____hash__

Page 40: Implementation of Rubik's Cube Formula in PyCuber

FORMULAIt's just a sequence of Steps

Page 41: Implementation of Rubik's Cube Formula in PyCuber

class Formula(list):

Page 42: Implementation of Rubik's Cube Formula in PyCuber

INITIALISING A FORMULAFormula([Step("R"), Step("U")])Formula("R U R' U'")

Page 43: Implementation of Rubik's Cube Formula in PyCuber

SEVERAL UTILITIES__mul____eq____lt__...etc

Page 44: Implementation of Rubik's Cube Formula in PyCuber

REWRITING METHODSappendinsertcountremove__contains__

Page 45: Implementation of Rubik's Cube Formula in PyCuber
Page 46: Implementation of Rubik's Cube Formula in PyCuber
Page 47: Implementation of Rubik's Cube Formula in PyCuber
Page 48: Implementation of Rubik's Cube Formula in PyCuber

REWRITING METHODS__add__extend

Page 49: Implementation of Rubik's Cube Formula in PyCuber
Page 50: Implementation of Rubik's Cube Formula in PyCuber
Page 51: Implementation of Rubik's Cube Formula in PyCuber
Page 52: Implementation of Rubik's Cube Formula in PyCuber

SPECIAL CASE!Formula.reverse

Page 53: Implementation of Rubik's Cube Formula in PyCuber

L2 U' R -> R' U L2

Page 54: Implementation of Rubik's Cube Formula in PyCuber

USEFUL METHODS

Page 55: Implementation of Rubik's Cube Formula in PyCuber

MIRROR!Formula.mirror()

Page 56: Implementation of Rubik's Cube Formula in PyCuber

L2 U' R -> R2 U L'

Page 57: Implementation of Rubik's Cube Formula in PyCuber

RANDOMFormula.random()

Page 58: Implementation of Rubik's Cube Formula in PyCuber

OPTIMISEFormula.optimise()

Page 59: Implementation of Rubik's Cube Formula in PyCuber

OPTIMISENo wide actionsNo whole cube rotationsNo repeated steps

Page 60: Implementation of Rubik's Cube Formula in PyCuber
Page 61: Implementation of Rubik's Cube Formula in PyCuber
Page 62: Implementation of Rubik's Cube Formula in PyCuber

INTERESTING FACTS

Page 63: Implementation of Rubik's Cube Formula in PyCuber

RUBIK'S CUBE IS 41 YEARS OLD!

Page 64: Implementation of Rubik's Cube Formula in PyCuber

FASTEST SOLVE

5.25 SECONDS BY COLLIN BURNS

Page 65: Implementation of Rubik's Cube Formula in PyCuber

FASTEST ONE-HANDED SOLVE

6.88 SECONDS BY FELIKS ZEMDEGS

Page 66: Implementation of Rubik's Cube Formula in PyCuber

FASTEST BLINDFOLDED SOLVE(Including memorisation)

21.17 SECONDS BY MARCIN KOWALCZYK

Page 67: Implementation of Rubik's Cube Formula in PyCuber

FASTEST NON-HUMAN SOLVING

3.253 SECONDS BY CUBESTORMER III

Page 68: Implementation of Rubik's Cube Formula in PyCuber

EVERY LEGAL PERMUTATION CAN BESOLVED IN 20 MOVES OR LESS

Page 69: Implementation of Rubik's Cube Formula in PyCuber

THERE ARE 43,252,003,274,489,856,000POSSIBLE PERMUTATIONS

Page 70: Implementation of Rubik's Cube Formula in PyCuber

HTTP://GITHUB.COM/ADRIANLIAWHTTP://GITHUB.COM/ADRIANLIAW/PYCUBER

Page 71: Implementation of Rubik's Cube Formula in PyCuber

pip install pycuber

Page 72: Implementation of Rubik's Cube Formula in PyCuber

“If you are curious, you’ll find the puzzles around you. If youare determined, you will solve them.”

– Ernő Rubik.