Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Rubik's cube challenge


p4plus2's Avatar
Member
0 0

Well, I thought about coding up a timed challenge that would require you to solve a rubik's cube. Before I go and spend the time coding this I wanted to get some feedback from the community on whatever comments or concerns you have about it.

Even if you normally can't solve a cube you would be able to use other various methods such as sending the puzzle to a external source, which is still practice though not nearly as fun as solving it yourself you get some practice at curl .

Thoughts, comments, opinions?


ghost's Avatar
0 0

psh, Rubik's cubes are easy to solve but that would be interesting, wouldnt mind seeing that :D


p4plus2's Avatar
Member
0 0

Yeah I recently got a 7*7 V-Cube, kills a lot of time in class :p


ghost's Avatar
0 0

We recently had a similar project in school. We were supposed to code a server and a client that would solve a soma cube. There you have to rotate each part and fit in. It was pretty hard but not impossible.

As for representation, it's probably best if you send it in text. Saying what color a certain bit is on the cube. Sending it in some special java thing will make it harder for people to use other languages.


ghost's Avatar
0 0

c4p_sl0ck wrote: As for representation, it's probably best if you send it in text. Saying what color a certain bit is on the cube. Sending it in some special java thing will make it harder for people to use other languages.

This. You send us the colours for each square on the cube, and then we send back the list of rotations needed to complete the cube, which the server then executes to validate.


ghost's Avatar
0 0

Just make sure that you construct a good protocol. We had one that sucked. :(


ghost's Avatar
0 0

I'd be up for it, a challenge is always good. Does sound insanely difficult though.. cURL does sound like the way to go on this one, although I'm not too sure how you would present the "cube data" because it has 6-dimensions (6 sides) which are all affected by movement. Difficult to write the challenge and difficult to complete it… sounds good :D


yours31f's Avatar
Retired
10 0

The only thing about it is there is a move you can do that will solve a rubix cube in anywhere from 150-350 moves just by repeating it. i belive its


||^   


--
-->

___
|-|         (Spin the front)
<--


--
-->


||^   


ghost's Avatar
0 0

Well obviously there has to be something like that, were hardly likely to be expected to code some AI into a timed challenge are we??? Without a repeatable move or sequence this challenge becomes virtually impossible.


ghost's Avatar
0 0

yours31f wrote: The only thing about it is there is a move you can do that will solve a rubix cube in anywhere from 150-350 moves just by repeating it. i belive its

Yeah, that's true.. as long as they didn't get points as soon as it was complete.. they have to submit a value when they have completed it? And just for fun, only let them submit this once ;) which means they will have to check themselves that the cube is complete, still some problems though


ghost's Avatar
0 0

backslash wrote: Yeah, that's true.. as long as they didn't get points as soon as it was complete.. they have to submit a value when they have completed it? And just for fun, only let them submit this once ;) which means they will have to check themselves that the cube is complete, still some problems though

Just once seems a little drastic, but one time per hour or something might be more realistic.


ghost's Avatar
0 0

Yeah, definitely needs a time delay anyway. Which means they would need to parse the cube themselves to see if it was complete or not. I'm assuming the cube would start in a random position each time?


ghost's Avatar
0 0

backslash wrote: Yeah, definitely needs a time delay anyway. Which means they would need to parse the cube themselves to see if it was complete or not. I'm assuming the cube would start in a random position each time?

Yeah I agree with the random position each time. However, just once per [time delay] would be pretty crap if this is going to be a timed challenge. Especially to those who're not fully experienced with their programming.. as a lot of the attempts may just be trying to get their code right.

Also, instead of doing the cube in 3D, if it would be difficult.. you could just do 2d displays of each individual face. I'm not sure if you already mentioned that, but I figured I would just incase.


ghost's Avatar
0 0

Perhaps instead of a time delay, if they get it wrong it "resets" the challenge, so they have to start again? That way they can figure their code out and complete the challenge.

You know what would be cool, making a "3d" image with PHP GD ;)


Uber0n's Avatar
Member
0 0

This is exactly the kind of challenge that HBH needs :D


p4plus2's Avatar
Member
0 0

Well thus far, based on the opinions I have seen these will be the following (rough estimate of features) -2D cube(the original plan) -I will randomize the cube based on the md5 hash of the time and a random number -A 2-5 min delay between attempts to reduce flooding -HTML based cube representation

If I missed anything in that list or you think I should add something lemme know ASAP :)


ghost's Avatar
0 0

Just remember to clearly state what the "protocol" is, e.g. how you tell the server to rotate it that way, etc. Can be a real pain in the ass if it's not clearly stated how all the details are supposed to be. :angry:


ghost's Avatar
0 0

sounds like it's going to be an awesome challenge, definitely would have fun beating it. Yeah and as c4p_sl0ck said, make sure the details are stated clearly.


p4plus2's Avatar
Member
0 0

Perhaps I will place a version for people to "test with" on my site so they can watch how everything turns.

As of writing this I have the top and bottom rotations(counterclockwise and clockwise) done.


ghost's Avatar
0 0

I'm really looking forward too seeing how it turns out. As long as you sort out the turns etc. then it will be awesome. Using arrays by any chance? I did something similar for an atonal matrix (music) in the past. Not quite the same though. Good luck!


p4plus2's Avatar
Member
0 0

I am using a multi dimensional array, it seems like a decent concept so far. The way I set up the array move horizontal rows in one swap, vertical are a bit more complicated but still not that bad. I will be using a session to store cube details so no mysql queries are needed.

Here is the key I will be using: ( the input for solving will be separated with a ';' ) C = clockwise CC = counterClockwise

'f' = front C 'fi' = front CC 'b' = back C 'bi' = back CC 'l' = left C 'li' = left CC 'r', = right C 'ri' = right CC 'u' = up C 'ui' = up CC 'd' = down C 'di' = down CC 'v' = vertical C 'vi' = vertical CC 'h' = horizontal C 'hi' = horizontal CC

The reason I choose 'i' was for inverted. If anybody disagrees with the key now would be the best time to speak. there are a total of 16 valid spins.


ghost's Avatar
0 0

Nice, I would have suggested a multi-dimensional array, I think you've planned it really well.. it could be really good!


p4plus2's Avatar
Member
0 0

Hey, I just figured Id give you guys a brief update…

The project is near completion but there is a glitch somewhere causing inconstancies, so if anybody is good with PHP and knows how a rubiks cube works(not necessarily solve, just how it turns) contact via aim or msn (p4plus2, p4plus2 [at] hotmail [dot] com)

Would appreciate it, if another person were to take a look at my source see if I overlooked an obvious flaw. After these flaws are tracked down it is practically finished!