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 / - Advanced 20 Line Compresser -

Author
Message
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 1st Oct 2005 00:48 Edited at: 18th Oct 2005 22:27
!!! SEE LATEST VERSION FIVE POSTS DOWN !!!


Hey well, as I was playing with Ric's compresser, I decided it could be better updated... And so, this was born...

Half credit goes to Ric for the idea and the basic framework.
A bit more credit goes to RiiDii for making the if then converter...
And what the heck, I put it all together and added the final spice...

Features:
- Converting of "if then" statements into "if : statement : endif"
- Removal of comments
- Removes excess whitespace (not inside strings)
- Concatation of sequential data statements
- Allows for functions to be compressed
- Will convert code into 25 commands per line (or variation of depending on circumstanses, there is only one case where it will make more than 25 commands but that's an extream case...)

And now da codz...

Full code:
[removed, see updated version]

And that concludes that... Many thanks to Ric and RiiDii!!!!

CPU

*small end note, to use, compile, go to the exe and drag and drop a code file onto the exe, it will be compressed and saved wherever the original file was with a _compressed extention on the filename, note that if the file was "file.dba" it would be "file_compressed.dba" instead of "file.dba_compressed.dba" like ric's and rii's old code was...

[Edit] My claims perhaps have been a little premature... I've been more thoughly testing it and have run up with some bugs... If you can see where I messed up it would be great, however as far as I can tell it still works for the most part...
CPU

[Further Edit] It seems that somehow the loop gets stuck after finishing reading all the data... thus it just stops and never exports the finished code... I'll still have to track down where it's crashing in the loop...

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 15th Oct 2005 06:11 Edited at: 15th Oct 2005 18:36
Ok nother update since you all are going wild about this and giving me all this amazing overwhealming support

Squashed that very nasty little bug I was experiencing to Rii's quote replacer and re-replacer... Shame on you rii...

Updated Feature List:
- If_then and quote replations no longer cause a hang!
- If_then's correctly converted
- Compiler can no longer be tricked into making lines longer than 25...
- Turning of #constants into globals (adds equals sign if needed)
- removal of inline comments
- removal of remstart remend comments
- removal of excess whitespace and tabs
- concatation of consecutive data statements into one long line...
- support for compressing (as best as it is possible) functions
- support for compressing subroutines
- drag and drop converting...

Well that about concludes it, unfortunatly, I could compress this code to 19 lines, however, mysterious errors creep up that I don't understand, I put line breaks in at random points and it seems to solve part of the issues, but there annoying and I have a feeling they have something to do with functions, I'll have to look much more closely into that.

Full Code:
[removed, see next post]

Other than that enjoy!

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 15th Oct 2005 18:33 Edited at: 18th Oct 2005 22:31
Woot Woot!

Well what'd ya know, even more updates and still all that generous overflow of helpfull support critizism comments!

Fixed, Updated, Added:
- Expanding of variables (ie. local xyz as integer = 1 into local xyz as integer : xyz = 1) it was causeing a whole crop of very nasty elusive bugs when you tried to compile compressed code
- Conversion of select case endcase endselect statements into if statements, it causes bugs if you have select and endselect on different lines, only problem with this that it can't convert "case default" but it gives you a warning and converts it into a if var = var form, it's the best I could do.
- Along with the above it supports conversion of nested select statemnts
- If a constant has a RGB value asigned to it it will split the statement
- Constants now convert correctly into globals, ie floats and strings
- Can Compress the compressor!
- All major known (and elusive!) bugs worked out

Full code:
Removed, see updated version

Compressed into 20 lines:
Removed, see updated version

And it all compiles real well on update 5.9b3

All fixed up and ready to go, and realy, I'm lovin the all the C&C(comments and critizism)

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:54
CPU: I've learned that folks just don't check this board as often.

Nice work on that code CPU!

The compressor is very impressive. Did you use that to compress the Towers demo you made?


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:38
Yep, and the Towers demo was a PAIN in the arse to get it to compress right, I was even having alot of trouble doing it by hand.. untill I figured out it was that having that "global var as something = 1" inline that was giveing me all those wierd errors. But now that I've finished it compiles without a hitch

That along with other things made me write the whole thing over from scratch, excepting a few functions, so that I could parse it right, it toke a lot of experimentation to find out what would compile and what wouldn't but as you can see it compresses stuff real nice, including itself

Thanks for the comments at last!

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:30
Ok, here's an updated version, I discovered that my compressor was somehow losing the first commands of every program, which was many times the sync on sync rate 0 commands...

Anyways fixed that lil problem:

Full Code:



Compressed Itself into 20 lines:



And enjoy!

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:52
Sorry, but I can' compile.
There's SYN's instead of SYNC's, and IL's instead on IF's in some places. And somewhere it can't close the nest, and stuff like that.

CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 22nd Oct 2005 04:00
argg.. one of those problems that periodicaly pop up on the forums, It does have everything correct and compiled fine (5.8) on my computer. I'll post a zip file with the code, hopefully it won't get corrupted this time.

CPU

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

Attachments

Login to view attachments
Ric
19
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 25th Oct 2005 01:11
Woah! Just spotted this thread (as Rii said, this part of the forum doesn't get checked that often). It's great to see the work we did developed like this and taken to a new level - kudos to you, CPU!

CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 25th Oct 2005 01:49
Ai! Your welcome Ric!

And thanks for the original idea

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Darken Programmer
18
Years of Service
User Offline
Joined: 24th Oct 2005
Location: In a box, outside of your room
Posted: 26th Oct 2005 19:32
Eh I can't compile either i've downloaded the zip file and im getting "Syntax Error. Function delcared has unknown parameter at line 193." Line 193 is

..Help?

Darken

TDK I love you... And yes.. You should be scared
UFO
18
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 30th Oct 2005 16:56
Same here...

CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 31st Oct 2005 01:45
Ahh, That would be because its for dbpro... It doesn't compile in classic.

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 2nd Nov 2005 10:35
The latest code (in code snippets) wont compile either. It has several cases of "syn" wich has to be "sync" and "il" that has to be "if", or even a missing "until" with a lonely "repeat".

Are you sure you can compile it on your computer?
I could adjust the "syn" and "il", but fixing a whole "until ..."?

Immunity and Annihalation makes Immunihalation...
CPU
20
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 15th Nov 2005 21:48
I think its a problem with my internet filter, put together sync and until and you get a bad word in the middle starts with a 'c' ends with 'unt' or something like that, Anyways, put comments between the sync and until statements, should fix that problem...



CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Nov 2005 00:29
didn't we have a challenge that turned this compressed code into readable code?


Deadly Night Assassins
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 20th Nov 2005 07:11
Yes.


Open MMORPG: It's your game!
UFO
18
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 22nd Nov 2005 01:18
Can someone please post a compiled version of this? I don't have DBPro.

Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 18th Feb 2006 08:01
V. Nice!

Here's the exe as asked:
[href][/href]

Jess.

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?

Attachments

Login to view attachments
dapaintballer 331
18
Years of Service
User Offline
Joined: 20th Dec 2005
Location: USA
Posted: 18th Feb 2006 21:16
i bought&installed the latest upgraded db pro and enhancement pack. (as of feb 18th 06)

it keeps saying "Command out of place" for this:

until file end(1)=1

~`Gamerssoft.com'~
Drew the G
User Banned
Posted: 18th Feb 2006 22:47
OMG, Jessticular!!!
One - I thought you died, you never posted much lately.

Two - That was one heck of a bump, are you still a mod?

Nice code, I have DBP. ^_^

dapaintballer 331
18
Years of Service
User Offline
Joined: 20th Dec 2005
Location: USA
Posted: 20th Feb 2006 00:37
if no one will fix my problem, can JessTicular help me?

JessTicular,
I drag a .dba file onto your exe. Both are on my desktop. It says loading line(lines flash here) When its done it just exits. Where does the new source appear? It doesn't get overwriten since it didn't change at all.

~`Gamerssoft.com'~
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 20th Feb 2006 14:13
CPU
I know that coding this not the easyest thing to do, however is their a chance that you might be able to make the compresser shorten the varable names we use in our code to something really un-meanfull just to make it smaller.

I'm not getting you down am I, Ho Look! another fancy Door?
Jess T
Retired Moderator
20
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 21st Feb 2006 07:21
Hey Drew
I'm still around here occasionally, just have other things that take up more of my time now-a-days... I'm still a Mod also, I do my part when I'm here... Try to keep things in order, and lately have been confirming some Bugs for U6.0.

dapaintballer,
Is there a text file created that says something like 'CrashOn' or 'ErrorReport' on your Desktop? If so, whip that open, see what line it says, then have a look at the code CPU posted, find the line, and then post it... There may be some problem with your PC not liking the creation of a new file..?

HowDo,
That would be quite a hard thing to do, considering that most variables aren't specifically declared...
And besides, it's really kind of pointless. If you really want to do it, run through a search/replace in the IDE and do it by hand

Team EOD :: All-Round Nice Guy
Want Better dbHelp Files?
Chris Franklin
18
Years of Service
User Offline
Joined: 2nd Aug 2005
Location: UK
Posted: 11th Apr 2006 13:48 Edited at: 11th Apr 2006 13:49
Awesome work cpu Thanks

Theme park simulator wip

UFO
18
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 9th Jun 2006 20:40
Wow. Thanks for the exe.

Great program, CPU! Its very helpful!!!

Login to post a reply

Server time is: 2024-04-25 02:33:34
Your offset time is: 2024-04-25 02:33:34