• Welcome to the Speedsolving.com, home of the web's largest puzzle community!
    You are currently viewing our forum as a guest which gives you limited access to join discussions and access our other features.

    Registration is fast, simple and absolutely free so please, join our community of 35,000+ people from around the world today!

    If you are already a member, simply login to hide this message and begin participating in the community!

Python for cubing programs?

Rainbow Flash

Member
Joined
Apr 22, 2014
Messages
82
Hi everyone,

I am a beginner in programming and I have begun learning the basics of programming with Python 2.

My question is:

How are some ways I can use my amateur programming skills in some way with connection to speedcubing? I've thought about making a timer, or an algorithm memorisation program, or maybe even a cube solver program, but I need some brainstorming from pros like you guys for a noob like me.

I'm at an early intermediate level with my 3x3 cube, with an average of around 27 seconds. I've also begun learning the Ortega method for the 2x2, and have been wondering if I could somehow write a program around the 2x2. Anyway, looking forward to replies...

print "Hello, speedcubing forums!"

Rainbow Flash
 

DeeDubb

Member
Joined
Mar 9, 2014
Messages
1,432
Location
South Korea
WCA
2014WHIT07
YouTube
Visit Channel
I also learned a little Python in college. It's a super fun programming language!

Honestly, as a beginning programmer, you probably won't be able to make anything that someone already hasn't done, but that shouldn't stop you from playing around with things.

Some fun things you could do

Basic:
Make random scramble generators. This should be pretty easy. Try to make it so it won't repeat the same moves back to back

Intermediate:
Make a timer. I have no idea how to mess with time stuff in Python, but it shouldn't be terribly difficult to start and stop the timer, and store the times somewhere, even calculate Ao5, Ao12, and Ao100.

Advanced:
Make an OLL/PLL practice tool. It would need you to be able to submit a list of OLL/PLL algorithms, it would need to reverse them to create the "practice scramble", display the practice scrambles randomly, and add your timer to time the results.
 
Joined
May 28, 2014
Messages
77
Location
Gloucestershire, UK
I often want to make stuff with Python or JS, but figure it's probably too tricky and just use Scratch.

Also why not Python 3?
Python 2 offers better input formatting and avoids some strange errors you can get with Python's unwillingness to shadow native types. I also think that 2 is the latest version to support pygame, making GUIs really easy to make.
 

Myachii

Member
Joined
May 24, 2014
Messages
884
Location
England
WCA
2013MORR03
YouTube
Visit Channel
I've been coding with Python for a year and a bit now, and I used Python 3 to make myself a simple over/under calculator, which tells me how many of the solves I paste in from GQTimer are below the time limit I specified. It was a really fun challenge, and I made a little average calculator to go with it :)

If you just intend to use this yourself and want a challenge, I suggest making something similar to what I have done (array + readfile knowledge required) or something basic that you think would be handy for yourself to use. As said above, it probably isn't the best tool for making new things that have never been done before.

print "Hello, speedcubing forums!"


(use python 3 :p)
 
Last edited:

qqwref

Member
Joined
Dec 18, 2007
Messages
7,830
Location
a <script> tag near you
WCA
2006GOTT01
YouTube
Visit Channel
Rainbow Flash: I don't recommend trying to make something new right off the bat. Start with some simpler cubing programs that will help you or people you know, like an alg trainer or maybe a stripped-down version of a program that you already use. That will help you get used to programming cubing stuff without getting so bogged down by the details of all the features you would add if you could. Once you have a good feel for it, if you have an idea for something new, you'll have a much better chance of getting it to work well.


I often want to make stuff with Python or JS, but figure it's probably too tricky and just use Scratch.
I find Javascript really easy to play with, since you can just make a file and open it in a browser. That helped a lot when I was making sims and stuff. It's also easy to take code from another project since most source code can be viewed directly.
 

Myachii

Member
Joined
May 24, 2014
Messages
884
Location
England
WCA
2013MORR03
YouTube
Visit Channel
That's not at all what was said above. And Python is great for both new and old stuff.



I don't know what you're doing, but neither do you. Please don't spread such misinformation.

Here's an example of a Python cubing tool using a GUI.
https://github.com/pochmann/sum-of-wca-ranks
I'd post more often if it weren't for these kind of responses. I was only stating tips from my own personal experience, maybe they were wrong, but I am not too familiar with GUI's and I don't use them myself. In my opinion, they over-complicate something that wouldn't hurt to just be shown in the Python Shell.
I do admit that my post was factually incorrect, and I apologise for that. But I really would appreciate feedback that weren't as harsh.
I'm still fairly new to Python, so I don't yet know my way around it completely. All I was trying to do was help someone who is currently in the position I was in, that we were all in, and show him the way that I progressed, and that was to avoid GUI's for the time being.

I don't mean to cause an argument. I'm here for the same reason as everyone else: To communicate and share experiences/ideas with other people who share the same hobby. I'm sorry for stating my thoughts as proven facts instead of saying that they may not be correct.
 
Last edited:

Rainbow Flash

Member
Joined
Apr 22, 2014
Messages
82
OK thanks guys for all your info, especially DeeDubb.

I saw what you wrote, qqwref, and I agree that I should start with simple stuff. Is there any website where I could get examples of a simple Python code, or at least have someone on speedsolving.com undergo some pains for me and write an example of a simple code?

Thanks for bearing with the noob,
Rainbow Flash

P.S. (I have just found codecademy.com and I'm loving it. It also has tutorials for Javascript and stuff like that, so I'll look into all that...)
 

ajayd

Member
Joined
Aug 16, 2012
Messages
117
Python's syntax is incredibly clean, whereas Perl has all these weird symbols and stuff. Besides that, Python just requires less words to do stuff, and the requirement of indents makes code really easy to read.
 

unsolved

Member
Joined
Mar 2, 2014
Messages
566
Location
Doylestown, PA
My opinion is that python's syntax and existing/growing userbase makes it a much better language to deal with.

Python's easier. It's alive. I see no downside.
How is the executable speed versus other coding environments? Also, does anyone have a 4x4x4 brute force solving program in python? I'm getting to the point where my own 4x4x4 solver is ready for optimization now that it is executing properly.

By the way, in C, I was able to come up with a board design that can make any 4x4x4 move using only 6 lines of code. By that I mean, take a 4x4x4 cube, make a move such as R' or u2 or b, and only 6 lines of code are needed to update the cube to its new configuration. It makes for a pretty fast move generator.
 

StachuK1992

statue
Joined
Jul 24, 2008
Messages
3,811
Location
West Chester, PA
WCA
2008KORI02
YouTube
Visit Channel
How is the executable speed versus other coding environments? Also, does anyone have a 4x4x4 brute force solving program in python? I'm getting to the point where my own 4x4x4 solver is ready for optimization now that it is executing properly.

By the way, in C, I was able to come up with a board design that can make any 4x4x4 move using only 6 lines of code. By that I mean, take a 4x4x4 cube, make a move such as R' or u2 or b, and only 6 lines of code are needed to update the cube to its new configuration. It makes for a pretty fast move generator.
Well, Python is a Very High Level programming language, and will naturally be factors slower than something written in C/C++.

That said, people have done some pretty fast things in other high-level programming languages (hell, JavaScript is surprising everyone with some performance gains!).

When it comes down to things, though, the algorithms you use are of course the most important thing.

I'd love to see that board design and the 6 lines that execute, in any language. ;)

[as far as I've seen, no decent 444 solver exists in python]
 

mark49152

Super Moderator
Staff member
Joined
Oct 29, 2012
Messages
4,703
Location
UK
WCA
2015RIVE05
YouTube
Visit Channel
can make any 4x4x4 move using only 6 lines of code
Do you mean 6 executed or 6 lines within a loop? I'd like to see that too.

I'm also interested in any examples of cube-related code in Python. Looking at examples is probably the best way of getting a feel for a language.
 
Top