Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

The 20 Line Challenge / Solving The Tower of Hanoi

Author
Message
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 15th Oct 2005 19:11 Edited at: 18th Oct 2005 22:34
!!! New Updated Version !!!

See updated post for details...


Ok, here's my little addition at last to the 20 line chalange, it's more of a graphical demo than anything.

The tower of hanoi puzzle goes like this:

you have three pegs, one of these pegs (peg A) you have x amount of disks, going from the biggest at the bottom to the smallest at the top.
Now your goal is to move all the disks from peg A to peg C, but there's a catch.
As you move the disks you can only move one disk at a time, and you can never set a larger disk on top of a smaller disk.

Keep that in mind as you solve it, but like I said it's also kindof a graphical demo, so there are some interactive keys:

Holding down the spacekey pauses the solving
Upkey zooms in
Downkey zoomes out
Return key toggles lights and fog

I thought I might also mention this, but the code is also FPS independent



Enjoy!

CPU

- don't foget the media

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]

Attachments

Login to view attachments
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 15th Oct 2005 19:38
OK CPU, great code!
But 5-6fps?!?!

Immunity and Annihalation makes Immunihalation...
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 15th Oct 2005 21:44
5-6fps?!!!!

I don't have a great computer but it still runs around 60!

What version of DBPro are you using, and what kind of computer are you on?

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 16th Oct 2005 21:46
Wow! Great work CPU! Absolutely amazing.


Open MMORPG: It's your game!
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 16th Oct 2005 22:39
Thanks, I presume it ran around 40 - 60+ FPS?

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 17th Oct 2005 10:28
I have version 5.8 (Don't use beta versions).

PC:
Intel Pentium IV 3.20 GHz
512MB RAM
120GB Hard disk (about 90GB left)
NVIDIA GeForce FX 5700LE
Windows XP Home edition
DirectX 9.0(c?)

Immunity and Annihalation makes Immunihalation...
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 17th Oct 2005 18:34
Yep - I got a steady 66 FPS (which is Sync Rate 60).


Open MMORPG: It's your game!
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 17th Oct 2005 19:37
I have absolutly no idea why it would run that slow

Are you sure something didn't get garbled and that sync rate still says sync rate 0?

and Rii, Sync rate was set at zero, you should be able to set it to 'bout anything and it'll run at the same speed, that is if I did my FPS independent right...

And if you want to run my compressor through it's paces you can see how it compresses this program

Here's the expanded code Sven B, see if that helps, other than that I don't know, this program was developed in 5.8 with similar spec's to your computer, so I don't know why it'd run this slow...



CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 17th Oct 2005 21:35
In the start it's like 46, and then it drops down to 10, and continues to decrement slowly until it reaches 6fps...
(+ checked the sync rate 0)

Nothing to do about it...

Immunity and Annihalation makes Immunihalation...
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 17th Oct 2005 22:56
Hmm.. Absolutly no idea...

Let me ask you a few questions...

About how long does it take for it to slow down from the start of the program?

Are you just letting it run or are you turning the lights on and off + zooming in and out, pausing unpausing?

Has this ever happened with other programs?

Put this line in the code after I display the onscreen prompts, (update function)
text 10,70,"On Screen Polygons: " + str$(Statistic(1))

See if the # of polygons gets above 5000 or so...

anything else you noticed?

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 18th Oct 2005 10:39


Really, I don't get it.

This is when doing nothing. No lights, pausing, etc.


What I do experience is that some people have extreme fps rates like 800 and all. Mostly, my pc is much slower and I don't come even near the sync rate...

Immunity and Annihalation makes Immunihalation...
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 18th Oct 2005 19:53


Ok - I'm lost, the only possible thing I can think of is the 'tractor beam' is deleted and recreated every loop, but other than that...

No clue why it'd be so slow on your computer, but without being there myself it's rather hard to fix those kind of errors, here, I'll 'lengthen' the code and stick a log file handler in here, run that and post the log after your done, I'll post that code it in a bit...

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 18th Oct 2005 20:57
Ok here's some code with logging capabilities, try it out, I think that our problem might be the recreation and deletation of my tractor beam each loop, which means I'm going bug hunting...

Try this out, let it run till it reaches around 7fps or so, then post the log file here and I'll see what I can do...



CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 18th Oct 2005 22:41
... Current Version ...


@Sven B - Sorry, this won't help your problem any, if anything it's more graphic happy than before...

Fixed a lil problem with the lights
Added more effects in the "party mode"
Added MUSIC!!!!
Added the ability to start and stop the music...
(music courtesy of vgmusic.com)

enjoy!



CPU

- Again, don't forget the media!

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]

Attachments

Login to view attachments
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 19th Oct 2005 17:04
Just if you're still interested, I posted the log file you asked before...

Immunity and Annihalation makes Immunihalation...

Attachments

Login to view attachments
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 19th Oct 2005 18:17 Edited at: 20th Oct 2005 07:11
ok I think I know what it is... unfortunatly... there's a problem with DBPro, has to do with deleting objects, I've had similar problems before where it took FOREVER to delete an object, I'll see what I can do, but there's no guarantee It'll fit in under 20 lines, I'll try, and if it works, then more power to me...

I was suspecting it was the delete object, your logfile confirmed it...

Hi ho! hi ho! Its off to work we go...

CPU

[edit] - ok, did a little bit of research into memblock manipulation and the vertex editing commands, but unfortunatly they all require me to make a mesh, delete the object, edit the mesh, and then recreate the object, which is precicly what I was doing before, minus the mesh commands...

As of right now I have a strong possiblity of a confirmed bug report dealing with this bug... you can see it here if you'd like, but it's the best I can do for now, unless you just want to remove the tractor beam entirely, in which case you'll need to just replace the tbeam function in the latest code with:



It'll fix your problem, but there won't be any cool tractor beam, unless, that is, they fix the problem in an upcoming patch, but for now this is the best I can do...

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 20th Oct 2005 19:31
Just an idea:
Maybez you can create 1 original object and CLONE all other tractor beams from it... (clone or instance, i don't know).

It'll be probably a little faster

Immunity and Annihalation makes Immunihalation...
FROGGIE!
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: in front of my computer
Posted: 20th Oct 2005 21:55
Cool, it saves me writing a how-to for my puzzel compo entry (UFO tomwers).

Thats really good for 20 lines, mine was about 500
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 21st Oct 2005 01:42
@Sven B - the only problem with that is no tractor beam is hardly ever the same... besides, I'd then have to delete the cloned object every loop

@Froggie - how does this save you from writing a how to?
and by the way, it was actualy written in about 700, then used that 20 line compressor program to turn it into 20 lines with a 25 command max per line...

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Freddy 007
19
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 21st Oct 2005 23:46
Wow. That looks very cool!

It ran great on my laptop.

CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 22nd Oct 2005 04:03
Thanks, at least most people arn't experiencing that slowdown Sven B is...

Did you get to look at all the features (IE, the 'advanced' mode, zooming in and out ans pausing?

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Drew the G
User Banned
Posted: 18th Feb 2006 23:01
Good job.

Login to post a reply

Server time is: 2024-04-20 02:41:47
Your offset time is: 2024-04-20 02:41:47