...

View Full Version : Drag n Drop Tower of Hanoi



glenngv
12-10-2002, 02:40 AM
I know there are many javascript versions of the classic game Tower of Hanoi out there (http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=Tower+of+Hanoi+Javascript).
But my version has Drag n Drop functionality. Try it (http://www21.brinkster.com/gver/javascript/hanoi.htm)! :cool:

Edited. Removed the IE message icon since this now works cross-browser. See page 3 of this thread for script update.
Edited again. It seems the message icon is not removed in the thread list. :confused:

jkd
12-10-2002, 03:26 AM
Maybe if you supported good browsers. Looking at your source code, it would be effortless to port it to W3C-compliant DOM code.

glenngv
12-10-2002, 03:48 AM
Of course, it would be better to support NS6 and other Gecko-based browsers. But this is an old code of mine that I have no time to improve yet. Just thought of sharing it here at the moment.
Thanks for your feedback though :)

premshree
12-10-2002, 06:05 PM
Here's my version (http://www.qiksearch.com/javascripts/towers-of-hanoi/index.htm) of the "Towers of Hanoi"...........not as good as yours though!

glenngv
12-11-2002, 07:34 AM
That's more of a demo than a game. :D

allida77
12-11-2002, 02:35 PM
regardless that is pretty cool.

glenngv
12-12-2002, 08:30 AM
which one? :)

allida77
12-12-2002, 06:35 PM
If you are talking to me yours is. Code is clean easy to follow.

glenngv
12-13-2002, 12:58 AM
Thanks allida77! :)

beetle
12-19-2002, 10:26 PM
Originally posted by premshree
Here's my version (http://www.qiksearch.com/javascripts/towers-of-hanoi/index.htm) of the "Towers of Hanoi"...........not as good as yours though! Dude, kill the alerts...nobody wants to click 'Ok' 255 times. I just killed my browser to get it over with.

glenngv
01-07-2003, 10:51 AM
I'm happy to announce that this game is now featured in Dynamic Drive. :)
http://www.dynamicdrive.com/dynamicindex12/hanoi.htm

Majik_Dance
01-07-2003, 02:54 PM
glengv -

Based on how addictive your last game was (The DHTML Same Game) there is NO way I am checking out your newest game !!

And yes, that is meant as a compliment

<mantra> Must work - must work </mantra>

glenngv
01-08-2003, 02:28 AM
I posted this game first :D
Thanks for the compliment anyway. :)

mark123
01-29-2003, 08:15 PM
You know the part I liked best? The part that locks your browser and causes you to either force quit or restart the computer.

beetle
01-29-2003, 10:59 PM
I finally figured out the trick! I can get it spot on every time! (minimum moves, that is ;))

Good work, glenn. :thumbsup:

mark123, I doubt anyone appreciates your facetiousness.

ionsurge
01-31-2003, 11:11 AM
I done it! 788 moves!

glenngv
01-31-2003, 11:35 AM
Originally posted by beetle
I finally figured out the trick! I can get it spot on every time! (minimum moves, that is ;))

Good work, glenn. :thumbsup:

mark123, I doubt anyone appreciates your facetiousness.

sshh, don't tell anyone the trick to beat the minimum moves :D
thanks for the compliment! :)
im flattered :o knowing the compliment comes from a guru like you.
btw, just curious have you already solved disks 8?

ionsurge
01-31-2003, 12:24 PM
That is what I solved... 788 moves yeah!

glenngv
01-31-2003, 12:35 PM
but you don't beat the minimum moves of 255 :D
but still you're amazing! :thumbsup:

beetle
01-31-2003, 01:25 PM
glenn

I never said I could do better than the minimum moves, I just have the mathematical pattern figured out so that I can the THE minimum number of moves every time. Gimme 12 disks and I could do it (granted, that would take FOREVER)

So, yes, I can do the 8 in exactly 255 moves :D

glenngv
01-31-2003, 01:37 PM
oopps sorry, wrong use of words. :o
what i meant was not to do better than the minimum number of moves. It's not possible at all.
The calculation for it is 2^N - 1 where N is the number of disks.

what i actually meant was to get the minimum number of moves, which you actually did in 8 disks! :thumbsup: :thumbsup:

beetle
01-31-2003, 01:53 PM
Hehe, ya, there's a very strict pattern to follow. Even where you place your first move, to tower 2 or 3, has an importance on solving it correctly.

glenngv
02-02-2004, 08:30 AM
Got new host so I'm updating the link for my games.

Tower of Hanoi (http://cc.1asphost.com/gver/js/hanoi.htm)
DHTML SameGame (http://cc.1asphost.com/gver/js/samegame.htm)

Edited. Web host problem :mad: so the link again won't work. Just go 5 posts down to see other links.

Willy Duitt
02-04-2004, 02:50 PM
Glenn;

You may want to check your links.
I am getting: HTTP 404 - File not found

However, it could be me.
I have been having trouble visiting some sites lately.

.....Willy

liorean
02-04-2004, 03:22 PM
It's not only you. I get the 404s as well.

glenngv
02-05-2004, 01:09 AM
It used to work when I posted it. Now I also get 404s.
I logged in at my host and it said that the root directory is not configured. I'll contact my host. :(

JAVAEOC
02-05-2004, 03:25 AM
IE only,

it doesnt work in NS cause ur using that drag and drop stuff, but it is possible to do it in NS or mozilla

I just dont seem to be able to find such a script on the INternet. :)

glenngv
02-05-2004, 03:28 AM
At the moment, you can download/play Tower of Hanoi at Dynamic Drive (http://www.dynamicdrive.com/dynamicindex12/hanoi.htm) and DHTML SameGame here (http://www.codingforums.com/showthread.php?s=&threadid=11775&pagenumber=2#post123561).

glenngv
02-05-2004, 03:38 AM
Originally posted by JAVAEOC
IE only,

it doesnt work in NS cause ur using that drag and drop stuff, but it is possible to do it in NS or mozilla

I just dont seem to be able to find such a script on the INternet. :)

That being an IE game only had been pointed out (http://www.codingforums.com/showthread.php?s=&threadid=11237#post54582) already.
And I know how to make it cross-browser, I just had no time to fiddle with it.

Willy Duitt
02-05-2004, 09:51 AM
Try this link (http://www.codingforums.com/showthread.php?s=&threadid=11775&post123561) for the Same Game.
I had trouble with the last one you posted Glenn.
It had a page number=2 in it that my browser didn't like.

.....Willy

glenngv
02-05-2004, 10:00 AM
Your link didn't go to a specific post in that thread. The pagenumber=2 is needed because the post I was referring to was there (2nd from the last post). The post123561 is supposed to be an anchor name but you prefix it with &amp; not # in your link.

Willy Duitt
02-05-2004, 10:29 AM
Hmmm;

Your link brings me to an essentially blank page with two Post buttons. :confused:

Attached is what I see.

.....Willy

glenngv
02-06-2004, 02:44 AM
I don't know why that happened but here's what I've got.

glenngv
02-06-2004, 02:53 AM
Sorry I forgot the attachment. (take note of the url in the screenshot)

You said earlier that you were having trouble visiting some sites lately. Maybe that could be the reason.

Willy Duitt
02-06-2004, 05:37 AM
Thanks Glenn;

I appreciate the confirmation.

I believe I found my problem in my local%20settings/temp folder.
Does anyone know what Perflib_Perfdata_6d4.dat is?

I searched the net and Microsoft but have not been able to find any reference. It wouldn't let me delete it until I went in thru my Administrator account in safemode and was able to open the file and delete its contents. Once I did that, my surfing problems ceased, but my browser wouldn't remember any settings. I have since did a system restore prior to my deleting the file contents but the problems are back. And getting worse.

Please excuse my interupting your thread. If anyone knows of a quick answer, great. If not, I will post in a tech forum.

Regards;
.....Willy

glenngv
03-02-2004, 11:33 AM
Originally posted by JAVAEOC
IE only,

it doesnt work in NS cause ur using that drag and drop stuff, but it is possible to do it in NS or mozilla

I just dont seem to be able to find such a script on the INternet. :)

Now modified to work cross-browser.
The Tower of Hanoi script featured in Dynamicdrive will probably be updated soon as I've already sent this update to them.

JAVAEOC
03-02-2004, 09:33 PM
glenn: this is totally amazing(i really like the fact that you are not using any images :))... but i have a few questions.

so, how did you manage to disable the highlight.
Usually whenever i try to drage something it highlights it but it doesnt seem to do that for your objects why? did you disable this or is it because u use div layers instead of images?

thanks alot

glenngv
03-03-2004, 01:38 AM
<body onselectstart="return false" oncontextmenu="return false">

I disabled it to prevent "wierd behavior" when dragging the disk while the document is highlighted. It only works with IE though.

I also disabled the contextmenu which works for both IE and NS7/Moz.

This is for a game so I guess those disabilities are fine with end-users.

JAVAEOC
03-03-2004, 01:54 AM
cool thanks alot

glenngv
03-03-2004, 02:11 AM
Welcome and thanks for the compliment. ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum