Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More Fun With JavaScript.... 3

Status
Not open for further replies.
Good luck! I really like the app so far. If Final Fantasy XI Online hadn't came out last week (and consequently leeched all my free time) I would almost be inspired to write that connect-4 game that I've been toying with in my head for the last 10 years. I'm sure you guys will see it eventually :)

-kaht
 
Hey - I was thinking about writing one of those myself ...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
I'll probably do it by myself, but thanks for the tip.

-kaht
 
This is a very strange feeling, I believe it is inverse,

We say impossible but really meaning more difficult.
But as the box grows so to do the possiblities for
solutions. So really the larger the box the more likely
there is a solution.

Does that hit anybody else like it does me.

I'm up to 9,560 clicks.

Just kidding......

2b||!2b
 
well.... the same holds true for a rubik's cube though, there's like 2 billion possible combinations for it, but if you switch just one cube around, it can become unsolvable. If you think of a rubik's cube 2 dimensionally it's not too unlike mwolf's tile program. And knowing that it can become unsolvable with a little twist of initial positions leads me to believe that the tile program can be unsolvable as well. But I could be wrong.....

-kaht

banghead.gif
 
Just FYI mwolf, the display locations only work in IE quirks mode. If you add a standards-mode doctype (as I had in the file I pasted your code into) you get all the tiles on top of each other, in Firebird and IE.

Looks alright in quirks mode IE though :)

PS. Surely it is acceptable that the 'impossible' level of difficulty is just that?

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
kaht: well.... the same holds true for a rubik's cube though, there's like 2 billion possible combinations for it, but if you switch just one cube around, it can become unsolvable.

Okay. I have got to chime in on this.

When operated in accordance with the rules of operation, a Rubik's Cube is demonstrably solvable. Always.

When you break the rules (and rotating a corner block clearly breaks the rules), then those rules stay broken. In the revised-rules scenario, the Cube is still solvable (re-rotate the block, or just disassemble and reassemble the Cube).

So, it's a bit of misdirection to declare the Cube unsolvable, unless you also allow a rule to be broken temporarily and then the game re-engaged with the rules re-established.

It would be the same thing if we started playing a game of chess, then in the middle of the game (or earlier, if I want a chance, because I really suck at chess), I replace all my non-kings with queens and all your non-kings with pawns and then said "Now let's see you win!" We see that as bogus logic, don't we?

Sorry for spinning off on that, but if it's any consolation, I waited until the second time I read it before responding.

Regarding the specific puzzle in this thread, I'm pretty sure solvability is a real factor. For example, this puzzle cannot be solved following the rules:

Code:
 _________
|[2][1][ ]|
|_________| <-- pretend this row isn't a row

There are topological proofs driving this conclusion. I'm pretty sure that larger iterations of the same problem are constrained by the same rules. However, we are lulled into thinking there's a solution because there are so many millions of moves that an obviously-unsolvable situation isn't apparent.

So, it's possible that a given configuration really could be impossible.

Near as I can tell from reading the code, the numbers are assigned positions at random. Based on this, I would suggest that there will be solvable and unsolvable combinations served indiscriminately. How yucky.

Now, you know what would be really delicious? Write a routine that starts with the known 6x6 block &quot;solved&quot; and creates a sequence of legal consecutive moves (1000 ought to be sufficient) at random, and then applies them, and then shows you the resultant cube. You don't even have to remember the moves: just repeat a thousand times {pick a random tile adjacent to the hole and move it into the hole}.

Let's face it, if you knew the problem was solvable, you would be much more interested in solving it, wouldn't you... [smile]

Cheers,


[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Hello
Dont like to show off...but I solved the 'impossible' in 574 clicks!!
Anyone up for the challenge??
 
mojaffa,
By 'impossible', did you mean the 6x6 setting labeled impossible, or the scenario I posted earlier?

Adam
while(ignorance==true){perpetuate(violence,fear,hatred);life--};
 
adam - he probably completed a 6x6 which could have been possible on some puzzles. I have posted a newer version of the code which is always solvable (never impossible - or even too hard).


thread216-700054

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top