This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
viluon's profile picture

AndyCode Lua Compression&Extraction 0.4 BETA [WIP] DYNAMIC!

Started by viluon, 11 April 2014 - 04:43 PM
viluon #1
Posted 11 April 2014 - 06:43 PM
AndyCode: Actual working code compression!

Tested on CC 1.62 (pure MC+Forge)

All-in-one Archiver is OUT!!!


Using czech keyboard special symbols that ComputerCraft cannot (properly) display => absolutely no probability to replace existing code!!!

Current dictionary size: 250 keywords

&growing!

Each keyword is converted into 2 symbol keycode

with the first one being a special symbol (@,#,/,etc.) and the second a czech symbol such as "č" or "á". This way even 3 letter keywords such as "for" or "end" are shortened!

version 0.4 BETA (post your ideas) usage/screenshots:

Spoilerusage:

As simple as this!

archiver <compress|extract|help> <file input path> <file output path>

screen:



To-Do list:

Spoiler

-use pcall() to safely (and nicely) handle errors
-add some nice GUI
-add Checksums
-extend dictionary DONE
-pack up the code (compressor+extractor=archiver :D/> ) DONE
-rewrite to API
-do some clean up
-stand-alone keyword dictionary and auto updating DONE
-interaction with OneOS
-self-extracting archives (SFXs)
-add Packaging-compress more files to one archive
-add usage of polish characters (more combinations) DONE

Downloads:

Spoiler


Alpha:
Note:Please note:Alpha versions are even worse than the Beta ones. They can cause unexpected data changes, they can steal your turtles, throw all your diamonds into lava and unload anti-game lag mods. Andy is not responsible for any data corruption or removals caused by any of these little *******. Use at your own risk and remember to have a shotgun by your side.

v.0.4b:
Spoiler

Archiver:
Link (Pastebin)





Beta:
Note:Please note:Beta versions can cause unexpected data changes. Andy is not responsible for any data corruption or removals caused by this program. Use at your own risk.

v.0.4.1:
Spoiler

Archiver:
Link (GitHub)
Link (Pastebin)
org file



v.0.4:
Spoiler

Archiver:
Link (Pastebin)
org file


v.0.3.2:
Spoiler

Archiver:

Link (Pastebin)


v.0.3.1:
Spoiler

Archiver:
Link (Pastebin)


v.0.3:
Spoiler

Archiver:
Link (Pastebin)

v.0.2:
Spoilerextractor:

Link (Pastebin)
compressor:

Link (Pastebin)
Stay always up-to-date: Link (GitHub)










Just in case ur curious, yes I'm czech :D/>


LIKE THIS? RATE +1 !!!



Notice: The project was officially put on hold. I don't have the time to work on it now, I may get back to it but do not count on it. Sorry but (at least) it's not over ;)/>




Shh! Hey, have u heard it? AndyCode 2 is coming, it's gotta work like ZIP (compressing anything, not just Lua code)
Edited on 03 September 2014 - 03:18 PM
Egor305 #2
Posted 11 April 2014 - 08:23 PM
Nice job!

I noticed, in your to-do list you have
-add usage of polish characters (more combinations)

How about adding cyrillic characters? Here I made list: ywCDhDXbTotal number of all new combinations possible with those is 288. They all are different unicode charecters.
viluon #3
Posted 11 April 2014 - 08:29 PM
You don't even know how much thankful I'm for such a positive feedback! Yeeey! :DD nice idea. I'm actually thinking of designing a C# app so I won't have to just write all those boring replace functions myself :D/> lazy programmer=good programmer! And yes, if I'll have time I'll surely include it!

Edit:Actually, using a combination of 2 symbol cyrillic keycodes (cyrillic-cyrillic) would bring me a way more combinations plus I can also include those czech and polish characters. I'll work on it :)/>
Edit2:using an additional set of 1 symbol cyrillic codes and decoding before 2 symbol would add shortening for 2 symbol keywords
Edit3:using multicase letters (which are not used now) would extend the dictionary even more
Edited on 12 April 2014 - 05:13 AM
apemanzilla #4
Posted 13 April 2014 - 01:02 AM
Screw it lets use Chinese symbols! That's a couple thousand more unique sumbols :D/>/>

Also, would be cool if you could host the dictionary on Dropbox or something and load it with HTTP. It shouldn't break any old compressed programs if done correctly.
Edited on 12 April 2014 - 11:02 PM
viluon #5
Posted 13 April 2014 - 10:27 AM
:D/> yes, chinese why not :D/> Ive completed a dictionary app (finally not in c# but lua) I use it on my Android phone together with SigmaScript here it is http://pastebin.com/GuGyCjds

Can make 1219 different translations (so far)

Yes stand alone dictionary is listed in the to do list

EDIT: Outdated, current D.App is on my github
Edited on 20 April 2014 - 03:46 PM
viluon #6
Posted 15 April 2014 - 04:35 PM
Archiver is OUT!!!
viluon #7
Posted 19 April 2014 - 01:39 PM
Current Work-in-progress:
-stand-alone dictionary updated from github
-dictionary expansion

New version at Monday 21st April!
Edited on 19 April 2014 - 11:39 AM
viluon #8
Posted 19 April 2014 - 03:28 PM
[BUGFIX] version 0.3.1 BETA
fixes:
-fixed behaviour when operating from a non-root folder (missing shell.resolve(sRelativePath))
Edited on 20 April 2014 - 03:36 PM
viluon #9
Posted 20 April 2014 - 03:38 PM
[HOTFIX] version 0.3.2 BETA
fixes:
-fixed extraction error when attempting to extract a non-existing file (now errors with "Can't open:Requested source file doesn't exist.")
Edited on 20 April 2014 - 01:38 PM
viluon #10
Posted 20 April 2014 - 07:07 PM
[PRE-UPDATE] version 0.4b ALPHA
org file, save to "./org"
additions:
*FAQ Help section (currently only 1 post)
*Dictionary system fully rewritten (see below)
*D.App is now a part of Archiver
*Archiver uses external file "org" to handle Dictionary entries
*most functions now check if files do exist before attempting to read/change them

changes:
+code clean up (partly)
+most functions use shell.resolve(sRelativePath)
+common errors are now commented with a sort of explanation

fixes:
-file encoding no longer change displayed symbols
-fixed bug(s) with accessing a file in current directory (was writing to ".&#46;&#46;/" instead of "&#46;&#46;/"), added shell.resolve(sRelativePath)
-some minor problems
viluon #11
Posted 21 April 2014 - 06:48 PM
Ive released a major update-version 0.4 beta, I will make the update post as usual later, cant do that on mobile now :/Edit: Posted, see below

Something about it:
This version brings a true usefulness to the program, many errors and weird glitches were fixed, as well as dynamic updating of the origin file was added. I can edit the origin file on my mobile phone and I will do that today (because dictionary wasn't extended yet). Auto updates are not yet implemented now, but org file will be redownloaded every time it's not present in the current directory and the program is run. In short, TO UPDATE org SIMPLY DELETE IT FROM THE FOLDER WITH ARCHIVER AND RUN THE PROGRAM.

Edit: I would appreciate any feedback
Edited on 22 April 2014 - 05:55 AM
LDShadowLord #12
Posted 21 April 2014 - 07:18 PM
Excellent, will definitely try it out when I have the time and see what comes of it.
viluon #13
Posted 21 April 2014 - 07:47 PM
org file updated as promised, now with 126 Keywords. I will add even more now. Epic note:backward compatibility is always preserved.

Excellent, will definitely try it out when I have the time and see what comes of it.
Thanks for feedback, I really need to know that someone likes it :)/>
Edited on 21 April 2014 - 05:46 PM
viluon #14
Posted 21 April 2014 - 08:30 PM
Another update of org, currently 222 kws
CastleMan2000 #15
Posted 21 April 2014 - 08:52 PM
Wow, watching this. How does it handle apis, strings, etc.?
viluon #16
Posted 21 April 2014 - 09:05 PM
Wow, watching this. How does it handle apis, strings, etc.?
Do you mean the currently loaded ones? There's no way to handle them cause They are local to the program they're loaded in, but common keywords used in e.g. OSes like process or kernel are (will be, not yet added to org) shortened. Simply said, it operates with the source file as a string and replaces keywords with key codes (look in the code, it's pretty straightforward)

EDIT: I plan to include a sort of local keywords in SFXs (SelF-eXtracting archives) as soon as they will be added.
EDIT2: I should've posted some screens of how files look before/after compression to show how does my code actually work… will do that as soon as I'll get to my PC
Edited on 21 April 2014 - 07:19 PM
CastleMan2000 #17
Posted 21 April 2014 - 09:24 PM
Wow, watching this. How does it handle apis, strings, etc.?
Do you mean the currently loaded ones? There's no way to handle them cause They are local to the program they're loaded in, but common keywords used in e.g. OSes like process or kernel are (will be, not yet added to org) shortened. Simply said, it operates with the source file as a string and replaces keywords with key codes (look in the code, it's pretty straightforward)

EDIT: I plan to include a sort of local keywords in SFXs (SelF-eXtracting archives) as soon as they will be added.
EDIT2: I should've posted some screens of how files look before/after compression to show how does my code actually work… will do that as soon as I'll get to my PC

Okay, that makes sense. So, any non-dictionary phrase is just kept?
viluon #18
Posted 21 April 2014 - 09:33 PM
Exactly. Simple yet powerful :)/>/>

Its based on an idea posted here on the forums (its mentioned in my post). Have a look at that code, it was a great idea but really messy and ineffectively done, so I continued in this and got AndyCode

EDiT: the less code is left untranslated the better (yes, that's obvious) so basically the more phrases the dictionary has the greater probability of high compression
Edited on 21 April 2014 - 07:39 PM
viluon #19
Posted 22 April 2014 - 07:18 AM
Table and term APIs were added to org
viluon #20
Posted 22 April 2014 - 07:53 AM
[UPDATE] version 0.4 BETA
org file
Additions:
*Basically ALPHA version 0.4b rewritten to BETA (see pre-update post)
*org file is downloaded from Pastebin.com every time it is not present in the directory with the archiver
Changes:
+all functions connected with opening/reading/checking the size of a file(s) now use
shell.resolve(".")..
(well, hopefully all…)
Fixes:
-fixed some bugs connected with bad relative path interpretation (see above)
-lots of bugs accidentally created from ALPHA development :D/>
-lots of glitches and minor problems

Known issues:
×When attempting to compress an already compressed file, instead of resulting in "comprimed by 0%" you can see something like "comprimed by -1.4210855E-14%". This is due to a Lua subtraction bug. Will be fixed in the next bugfix.
Edited on 22 April 2014 - 05:58 AM
Agoldfish #21
Posted 24 April 2014 - 08:30 PM
Will you just update the OP instead of bumping it with updates? Another idea; make the update notes smaller and edit them in with replies from other people.
viluon #22
Posted 25 April 2014 - 02:45 PM
Will you just update the OP instead of bumping it with updates? Another idea; make the update notes smaller and edit them in with replies from other people.
Ok, I'll try but I've got some weird issues with BBCode when editing large posts… it's kinda buggy :// I'll try
LDShadowLord #23
Posted 30 April 2014 - 09:28 PM
Question, would this work for compressing rednet messages before sending them?
viluon #24
Posted 01 May 2014 - 03:42 PM
Yes of course, any Lua code can be compressed
LDShadowLord #25
Posted 01 May 2014 - 04:54 PM
So to clarify, the messages would not get garbled by sending them across rednet?
viluon #26
Posted 01 May 2014 - 06:09 PM
Nope, unless because of a bug I don't know about. Did you encountered some?
skwerlman #27
Posted 01 May 2014 - 09:23 PM
So to clarify, the messages would not get garbled by sending them across rednet?
You are remembering to unarchive them on the other end, right?
Lyqyd #28
Posted 01 May 2014 - 10:14 PM
If any characters have byte values above 127, they will be mangled by transmission via rednet.
viluon #29
Posted 04 May 2014 - 11:27 AM
Thanks Lyqyd, didn't know that :)/>
apemanzilla #30
Posted 04 May 2014 - 02:18 PM
If any characters have byte values above 127, they will be mangled by transmission via rednet.
Does this hold true for characters in tables sent over rednet?
Rougeminner #31
Posted 04 May 2014 - 05:30 PM
I have no IDEA what this problem is i have tried to track it down but i can't

Anycode line 131 is returning an error (and i am sure you know what it is but incase you don't it is "file does not exists ./org) please help i am dieing to use this
:)/>
Rougeminner
edit1: oops i just reread my comment i am not good a typing 20 words a minute at 7 AM :P/>
Edited on 11 May 2014 - 10:58 PM
viluon #32
Posted 04 May 2014 - 07:25 PM
I'll help you ASAP but (as you might have already noticed because of no new updates) the project is put on hold for now. I work on it when I have the time to do so, and I don't have it now. I'll make a bugfix for you tomorrow, k? I'd do it now but I have a history test tomorrow and I can't fail it. Anyway thanks for the interest! :)/>
Lyqyd #33
Posted 04 May 2014 - 07:56 PM
If any characters have byte values above 127, they will be mangled by transmission via rednet.
Does this hold true for characters in tables sent over rednet?

I believe so, but it would be wise to test this to confirm.
Rougeminner #34
Posted 05 May 2014 - 12:13 AM
I'll help you ASAP but (as you might have already noticed because of no new updates) the project is put on hold for now. I work on it when I have the time to do so, and I don't have it now. I'll make a bugfix for you tomorrow, k? I'd do it now but I have a history test tomorrow and I can't fail it. Anyway thanks for the interest! :)/>

Thank you so much.
viluon #35
Posted 05 May 2014 - 05:29 PM
[BUGFIX] version 0.4.1 BETA
I won't write changelog here because you don't want it here.. However, I wrote this post because of an

Important note: This bugfix made changes in org file and ruined up backward compatibility. From now on backward compatibility will not be preserved up to version 0.5. This is due to bugs that were created during the development of earlier versions and cannot be fixed without changing the "protocol" of org file and technique used to read it. Thanks for understanding.
Prepare for other crucial changes in the program, this is Beta…