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 / - 20 line challenge compressor/decompressor -

Author
Message
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 2nd Aug 2005 03:26 Edited at: 2nd Aug 2005 03:30
Here's are two twenty liners which actually help you make twenty liners!

The first is a decompressor which will automatically decompress code in 20 line challenge format (ie 25 commands per line) into normal format for easy reading.



To use it, here's what you need to do (it's really easy!)

1. Make a new project, paste the above code, and save it as 'decompressor.dbpro'. Then run it - nothing will happen, but it will make the code into an executable, decompressor.exe.

2. Grab any 20 liner you like, save it as a .dba source file, and simply drag and drop it onto the exe. The decompressor will then decompress it and save it in the same folder.

One limitation I realised, is that it doesn't like it if the 20-liner has colons within speech marks - it gets confused and thinks that's a command separator.


And the second is a compressor for those of you who want to turn your normal code into 20-line challenge format:



Use it in the same way - turn it into an executable, then drag your dba onto it and it will compress it into 25 commands per line, and tell you if it goes over twenty lines.

The limitations are that you can't use functions, if-then's (use if-endif's instead), or remarks (rem or `) - those are limitations of the 20-line format, not the compression code!

If people find this useful, some kind mod might sticky it!

EvMaster
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Australia
Posted: 2nd Aug 2005 10:02
Wow, I was able to compress almost 150 lines into 6!
I had no idea this was possible!
I've always been looking for a way to do this, I even started my own program similar to this one but gave up coz the commands weren't working.
This should definitely be stickied, it's such a useful tool!

Thanks dude and well done!
-Ev

AMD939 3500+, Gigabyte PCI-E X800XL 256mb, 1024mb RAM
Logitech Z680 5.1 Speakers
Kohaku
19
Years of Service
User Offline
Joined: 3rd May 2004
Location: The not very United Kingdom
Posted: 2nd Aug 2005 13:18
That's a really good idea! I'll try it out now.


You are not alone.
The Nerd
19
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 2nd Aug 2005 13:21 Edited at: 2nd Aug 2005 13:23
@Ric:

Wow! Thats pretty awsome!

LoL With all those good comments you could make a hole website about the program and use those lines as comments from users:

Quote: " Wow, I was able to compress almost 150 lines into 6! - EvMaster"


Quote: " That's a really good idea! - Aura"


Quote: "Wow! Thats pretty awsome! - The Nerd"


LoL!^^

But i mean it.. It's awsome!
Someone should really stickie this!

Visit PanzerGames here
Kohaku
19
Years of Service
User Offline
Joined: 3rd May 2004
Location: The not very United Kingdom
Posted: 2nd Aug 2005 13:24 Edited at: 2nd Aug 2005 13:42
Well, I compressed the compressor to one line. I like!

Hmm, it won't compile the compressed compressor.

"Error on line 1"..


You are not alone.
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 2nd Aug 2005 17:02
Quote: "Well, I compressed the compressor to one line. I like!

Hmm, it won't compile the compressed compressor."


Lol! How did I know someone would try that! Unfortunately it contravenes the if-then limitation - it might work if it were replaced with if-endif's instead though.

Thanks everyone for the positive feedback.

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 4th Aug 2005 08:34
And here is an IF_THEN converter.

Use it the same way as Ric's converters (I copied his reader/writer anyway ). It keeps the statement all on one line and uses colons. To spread it out to more than one line, simply use Ric's 20-Line Code Decompiler .



And here's some test code lines I tried. Feel free to try more and see if you can fool it: I'll try and make it work for most any situation (except uncompilable code or extremely silly situations).



"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Freddy 007
19
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 15th Aug 2005 22:32
Pretty awesome.

I haven't tested WHY but this:




That code acts different after you compress it. It's like it skips the CLS command.

Here's the compressed version:



*** PANZERGAMES ***
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 17th Aug 2005 02:14
Hmmm..... it also seems to ignore the first four print statements. Don't know why I'm afraid - nothing to do with the compression code, just something weird with the way dbp interprates code on the same line. I think you'd be justified in posting this in the bug forum if you wanted.

Darkbasic MADPSP
18
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 17th Aug 2005 13:04
The best i'll ask a mod to sticky it for you

Love games go to http://www.freewebs.com/halorc
or
http://www.freewebs.com/gamersmad

Login to post a reply

Server time is: 2024-04-25 18:08:20
Your offset time is: 2024-04-25 18:08:20