SlideShare a Scribd company logo
RUBIK'S CUBE
FORMULA IN PYCUBER
Adrian Liaw
http://bit.ly/1QdarwT
ABOUT ME
Junior high school student
Home-schooling
"Learning Reinforcer" at Agilearning
OTHER INTERESTS
Classical Piano
AGENDA
Why / What's PyCuber
Several Parts in PyCuber
Rubik's Cube (And Notations)
Implementations
Things About Rubik's Cube
JUST FOR FUN
IMPLEMENT PARTS IN
PYCUBER
cube.py
formula.py
solver/
RUBIK'S CUBE
ERNŐ RUBIK
RUBIK'S CUBE
RUBIK'S REVENGE
PROFESSOR'S CUBE
OVER THE TOP
POCKET CUBE
...
NOTATIONS
SINGMASTER NOTATION
BASIC NOTATIONS
R (right)
L (left)
U (up)
B (bottom)
F (front)
B (back)
R
L
U
D
F
B
F'
U2
WIDE TURNS
r
l'
d2
WHOLE CUBE
ROTATIONS
x
y'
z2
IT'S TIME FOR SOME PYTHONIC STUFF
CLASSES
Step
Formula
STEP
face (F, L, d, y)
extra symbol (counter-clockwise, 180 degrees)
SEVERAL UTILITIES
__add__
__mul__
__hash__
FORMULA
It's just a sequence of Steps
class Formula(list):
INITIALISING A FORMULA
Formula([Step("R"), Step("U")])
Formula("R U R' U'")
SEVERAL UTILITIES
__mul__
__eq__
__lt__
...etc
REWRITING METHODS
append
insert
count
remove
__contains__
REWRITING METHODS
__add__
extend
SPECIAL CASE!
Formula.reverse
L2 U' R -> R' U L2
USEFUL METHODS
MIRROR!
Formula.mirror()
L2 U' R -> R2 U L'
RANDOM
Formula.random()
OPTIMISE
Formula.optimise()
OPTIMISE
No wide actions
No whole cube rotations
No repeated steps
INTERESTING FACTS
RUBIK'S CUBE IS 41 YEARS OLD!
FASTEST SOLVE
5.25 SECONDS BY COLLIN BURNS
FASTEST ONE-HANDED SOLVE
6.88 SECONDS BY FELIKS ZEMDEGS
FASTEST BLINDFOLDED SOLVE
(Including memorisation)
21.17 SECONDS BY MARCIN KOWALCZYK
FASTEST NON-HUMAN SOLVING
3.253 SECONDS BY CUBESTORMER III
EVERY LEGAL PERMUTATION CAN BE
SOLVED IN 20 MOVES OR LESS
THERE ARE 43,252,003,274,489,856,000
POSSIBLE PERMUTATIONS
HTTP://GITHUB.COM/ADRIANLIAW
HTTP://GITHUB.COM/ADRIANLIAW/PYCUBER
pip install pycuber
“If you are curious, you’ll find the puzzles around you. If you
are determined, you will solve them.”
– Ernő Rubik.

More Related Content

More from Wey-Han Liaw

Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Wey-Han Liaw
 
Educational Code Reviews
Educational Code ReviewsEducational Code Reviews
Educational Code Reviews
Wey-Han Liaw
 
Learning: Being as a Homeschooled Student
Learning: Being as a Homeschooled StudentLearning: Being as a Homeschooled Student
Learning: Being as a Homeschooled Student
Wey-Han Liaw
 
Jupyter Kernel: How to Speak in Another Language
Jupyter Kernel: How to Speak in Another LanguageJupyter Kernel: How to Speak in Another Language
Jupyter Kernel: How to Speak in Another Language
Wey-Han Liaw
 
Udacity Taipei meetup #2 如何駕馭線上課程
Udacity Taipei meetup #2 如何駕馭線上課程Udacity Taipei meetup #2 如何駕馭線上課程
Udacity Taipei meetup #2 如何駕馭線上課程
Wey-Han Liaw
 
Python自學從你小時候開始
Python自學從你小時候開始Python自學從你小時候開始
Python自學從你小時候開始
Wey-Han Liaw
 
Meteor Taipei 2016 January talk -- Mantra
Meteor Taipei 2016 January talk -- MantraMeteor Taipei 2016 January talk -- Mantra
Meteor Taipei 2016 January talk -- Mantra
Wey-Han Liaw
 
Understanding Meteor Stack
Understanding Meteor StackUnderstanding Meteor Stack
Understanding Meteor Stack
Wey-Han Liaw
 
Async, await
Async, awaitAsync, await
Async, await
Wey-Han Liaw
 
SITCON summer camp 2015: Adrian說他那身邊的一堆社群
SITCON summer camp 2015: Adrian說他那身邊的一堆社群SITCON summer camp 2015: Adrian說他那身邊的一堆社群
SITCON summer camp 2015: Adrian說他那身邊的一堆社群
Wey-Han Liaw
 
NCCU 0617 talk
NCCU 0617 talkNCCU 0617 talk
NCCU 0617 talk
Wey-Han Liaw
 
PyCon 2015 Crawler Tutorial Explain Cookies
PyCon 2015 Crawler Tutorial Explain CookiesPyCon 2015 Crawler Tutorial Explain Cookies
PyCon 2015 Crawler Tutorial Explain Cookies
Wey-Han Liaw
 
PyCon 2015 Crawler Tutorial Explain Encoding
PyCon 2015 Crawler Tutorial Explain EncodingPyCon 2015 Crawler Tutorial Explain Encoding
PyCon 2015 Crawler Tutorial Explain Encoding
Wey-Han Liaw
 

More from Wey-Han Liaw (13)

Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
Python 官方文件中文翻譯專案 - 探討翻譯專案的貢獻流程
 
Educational Code Reviews
Educational Code ReviewsEducational Code Reviews
Educational Code Reviews
 
Learning: Being as a Homeschooled Student
Learning: Being as a Homeschooled StudentLearning: Being as a Homeschooled Student
Learning: Being as a Homeschooled Student
 
Jupyter Kernel: How to Speak in Another Language
Jupyter Kernel: How to Speak in Another LanguageJupyter Kernel: How to Speak in Another Language
Jupyter Kernel: How to Speak in Another Language
 
Udacity Taipei meetup #2 如何駕馭線上課程
Udacity Taipei meetup #2 如何駕馭線上課程Udacity Taipei meetup #2 如何駕馭線上課程
Udacity Taipei meetup #2 如何駕馭線上課程
 
Python自學從你小時候開始
Python自學從你小時候開始Python自學從你小時候開始
Python自學從你小時候開始
 
Meteor Taipei 2016 January talk -- Mantra
Meteor Taipei 2016 January talk -- MantraMeteor Taipei 2016 January talk -- Mantra
Meteor Taipei 2016 January talk -- Mantra
 
Understanding Meteor Stack
Understanding Meteor StackUnderstanding Meteor Stack
Understanding Meteor Stack
 
Async, await
Async, awaitAsync, await
Async, await
 
SITCON summer camp 2015: Adrian說他那身邊的一堆社群
SITCON summer camp 2015: Adrian說他那身邊的一堆社群SITCON summer camp 2015: Adrian說他那身邊的一堆社群
SITCON summer camp 2015: Adrian說他那身邊的一堆社群
 
NCCU 0617 talk
NCCU 0617 talkNCCU 0617 talk
NCCU 0617 talk
 
PyCon 2015 Crawler Tutorial Explain Cookies
PyCon 2015 Crawler Tutorial Explain CookiesPyCon 2015 Crawler Tutorial Explain Cookies
PyCon 2015 Crawler Tutorial Explain Cookies
 
PyCon 2015 Crawler Tutorial Explain Encoding
PyCon 2015 Crawler Tutorial Explain EncodingPyCon 2015 Crawler Tutorial Explain Encoding
PyCon 2015 Crawler Tutorial Explain Encoding
 

Recently uploaded

Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 

Recently uploaded (20)

Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 

Implementation of Rubik's Cube Formula in PyCuber