iDevGames Forums
Programming Challenge! - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Community Zone (/forum-4.html)
+--- Forum: Contests (/forum-19.html)
+--- Thread: Programming Challenge! (/thread-5856.html)



Programming Challenge! - blobbo - Feb 21, 2005 08:45 PM

Hi all!

So my girlfriend is a Math major, and she's spent the last few days obsessing over this rubix cube. Frankly, I don't have the patience for it - I spend about 3 minutes with it and get frustrated. But what I thought would be neat is if I could program some sort of brute force algorithm to solve it.

Now I'm sure this has been done countless times before, but here's my challenge:

Program in Objective C and Cocoa a program that will solve a rubix cube. Bonus points if you determine how to solve it using rules (to be followed in real life). Bonus points if your program actually displays a rubix cube. Major points if it's 3D. Major uber geeking rights if you can "play" - i.e. if you can rotate the segments yourself. Super incredible bonus geeking rights if you can peel off the stickers and cheat Wink

I think this should be a fun one. I look forward to seeing what people come up with. Note that the Obj-C and Cocoa is just a suggestion. Use your preferred API. Oh, and all source has to be open - I want to see how you do it!

Let's say a week time deadline, starting at the time of this post. Cheers!


Programming Challenge! - iefan - Feb 21, 2005 09:17 PM

Not to rain on your parade, but there's been a few implementations already...

http://www.javaonthebrain.com/java/rubik/
http://lar5.com/cube/ (bottom right solves it)
http://osx.hyperjeff.net/Apps/apps.php?sub=100&ft=0&f=rubik%27s+cube&p=0&s=off&l=&w=0&t=0&fm=1

But that doesn't mean you can't have fun doing it.


Programming Challenge! - PowerMacX - Feb 22, 2005 12:18 AM

blobbo Wrote:So my girlfriend is a Math major, and she's spent the last few days obsessing over this rubix cube. Frankly, I don't have the patience for it - I spend about 3 minutes with it and get frustrated.
[...]Major uber geeking rights if you can "play" - i.e. if you can rotate the segments yourself.
[...]

I spend about 2 minutes and I solve it Wink
My record was 45 seconds (many times), but... well, eventually you get bored of solving it Rasp

As ieafan said, there are already plenty of implementations, none of which use brute force - ask your Math major girlfriend how many different combinations are there for just 10 "rotations" Wink (quarter or half turn of any face/slice, including the middle one)
They are all based on rules (except for a few lame ones that can only "scramble and rollback every move" but they don't really "solve" anything!).

Note: It takes way more than 10 rotations Wink

Edit: New Record! 4 (four) " Wink " smilies in a single post! Woohoo!!!
Blush


Programming Challenge! - iefan - Feb 22, 2005 07:27 AM

PowerMacX Wrote:Edit: New Record! 4 (four) " Wink " smilies in a single post! Woohoo!!!
Blush

I saw "New Record! 4" and I thought you were going to tell us you solved a cube in four rotations. I was gonna flip out. Wink


Programming Challenge! - Jake - Feb 23, 2005 04:22 PM

Funny, I just got into the Rubik's cube, I have worked my way down to a 1:14 fast time with an average of 1:35 in about 3 weeks, my goal is an average of 1:00 and I am still learning new algorithms

Any cube can be solved in 28 or less moves, with there being 12 moves for the first move and 11 for each other move (no going forward and back to the same spot again) that would leave 12*11^27 combos for brute force . Thats a big number.