Author Topic: [83+ BASIC] Compressors  (Read 14652 times)

0 Members and 1 Guest are viewing this topic.

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[83+ BASIC] Compressors
« on: August 05, 2006, 02:44:00 pm »
Wow im rele in need of some Matrix,list, and string compressors. Because seriously I have this game that would be a lot easier to play if I could put a loading screen in and have all the things decompressed.
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline rivereye

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 996
  • Rating: +0/-0
    • View Profile
[83+ BASIC] Compressors
« Reply #1 on: August 05, 2006, 02:45:00 pm »
I don't know if there are, and it may not really be worth it.
>(<')

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[83+ BASIC] Compressors
« Reply #2 on: August 05, 2006, 02:53:00 pm »
No like say there was a matrix
[4,2,5,7]
[2,4,76,5]
[10,1,5,6]
[24,2,6,1]
155 Bytes

Then compressed into a list it is

{4257,24,1,5,1,156,1,261,761024}
90 Bytes

1 is a token to double numbers which a listed at the end
There are 10 types of people in this world-- those that can read binary, and those that can't.

Dragon__lance

  • Guest
[83+ BASIC] Compressors
« Reply #3 on: August 05, 2006, 04:06:00 pm »
it shouldn't be that hard to make one yourself in BASIC.Here's my idea.I'd recommend compressing to string.For isntance:
[1,2,3]
[4,5,6]
[7,8,9]
(92 bytes)
becomes "100200300400500" (the 00's represent empty spaces so you can fit 3 digit numbers)
(38 bytes)
Then when you decompress,use
:expr(sub(str,X,3->[A](A,B

just run that command through a loop,and it should work :Dbiggrin.gif

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[83+ BASIC] Compressors
« Reply #4 on: August 06, 2006, 04:10:00 am »
That's a great idea but then you can only transfer ten compressed levels, but that helped me because the list form of that which is {100200300,400500600,700800900} and that is 41 bytes and you can transfer many compressed levels like that.
There are 10 types of people in this world-- those that can read binary, and those that can't.

Demon

  • Guest
[83+ BASIC] Compressors
« Reply #5 on: August 06, 2006, 04:23:00 am »
I have a String to List converter I made that converts Strings to Lists and compresses them...  I could take that and just leave the compression part and have a list compressor right there...

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[83+ BASIC] Compressors
« Reply #6 on: August 06, 2006, 04:34:00 am »
That's cool and if you want to you could post the code.
There are 10 types of people in this world-- those that can read binary, and those that can't.

Dragon__lance

  • Guest
[83+ BASIC] Compressors
« Reply #7 on: August 06, 2006, 06:12:00 am »
i'd still recomend using string compression,if your worried about number of levels it can compress.Just fit all your levels into 1 string.Then use a character like '-' to mark where one level ends and another begins.Then use-
:instring(str,'-',1

to find the location and start compressing from there.But if you want to use list compression,heres an idea.
:{100200300,400500600,700800900}->L1
:int(E-6L1(1->[A](1,3


basically use decimels to divide up the data ;)wink.gif

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[83+ BASIC] Compressors
« Reply #8 on: August 06, 2006, 06:16:00 am »
Your actually right i think string compression would be better
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
[83+ BASIC] Compressors
« Reply #9 on: August 06, 2006, 08:28:00 am »
Well I made something like this for my Tank game, which compressed one of my maps data 84%. The code allows for decimals, for actions in game.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
[83+ BASIC] Compressors
« Reply #10 on: August 06, 2006, 08:57:00 am »
how fast did it ran?

Demon

  • Guest
[83+ BASIC] Compressors
« Reply #11 on: August 06, 2006, 09:49:00 am »
Here are my string to list and list to string converters.
Results are stored in Ans.
Imported from Graphlink (which is why you see all that odd slashed stuff.

String to List
c1-->
CODE
ec1\start83P\
\comment=Single file dated Sun Aug 06 15:43:20 20
\protected=FALSE
\name=ZS2L
\file=D:\TISTUF~1\0PROGR~1\ZS2L.TXT
Ans\->\Str1
{0\->\L\6\:0\->\X:1\->\Y
ClrHome
Output(1,1,"Str1NG->\L\IST:
For(W,2,length(Str1
Output(1,14,int(W/length(Str1)*100
inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ\theta\ :?\^-1\^\^2\,()/789*456-123+0.\(-54125+)\\^3\!=\!=\>\>=\<\<=\\o\'\r\\pi\\EE\{}\e\[]\i\\dot\\cross\\box\\T\",sub(Str1,W,1
If Ans:Then
X+(Ans*.01^Y\->\X
Y+1\->\Y
If Y=6:Then
X\->\L\6\(1+dim(L\6\
DelVar X1\->\Y
End:End:End
If X:X\->\L\6\(1+dim(L\6\:ClrHome:L\6\
DelVar XDelVar YDelVar ZDelVar L\6\
\stop83P\c2
ec2

List to String
c1
-->
CODE
ec1\start83P\
\comment=Single file dated Sun Aug 06 15:43:19 20
\protected=FALSE
\name=ZL2S
\file=D:\TISTUF~1\0PROGR~1\ZL2S.TXT
Ans\->\L\6\:" \->\Str1
If dim(L\6\:Goto R
Menu("ERR:LIST EMPTY","QUIT",X
Lbl X:0:Return
Lbl R
ClrHome
Output(1,1,"\L\IST->Str1NG:
For(W,2,dim(L\6\
Output(1,12,int(W/dim(L\6\)*100
L\6\(W\->\X
Repeat not(fPart(X
100fPart(round(X,2\->\Y
100X\->\X
If fPart(Y) or Y<1 or Y>75:DelVar X
If not(X:Then
.02\->\L\6\(W:2\->\Y
End
Str1+sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ\theta\ :?\^-1\^\^2\,()/789*456-123+0.\(-54125+)\\^3\!=\!=\>\>=\<\<=\\o\'\r\\pi\\EE\{}\e\[]\i\\dot\\cross\\box\\T\",Y,1\->\Str1
End:End:0\->\L\6\(1
ClrHome
":
prgmZSTAT:Str1
DelVar Str1DelVar VDelVar W
\stop83P\c2
ec2

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
[83+ BASIC] Compressors
« Reply #12 on: August 06, 2006, 10:42:00 am »
@kevin: It depends on the size, but for my 24x16 (WxH) it took 10 seconds on average.

@pyro_xp2k: Looks like it could be simpler, but it looks like it would work. And you may want to look at not using lbls.

Demon

  • Guest
[83+ BASIC] Compressors
« Reply #13 on: August 06, 2006, 10:58:00 am »
Yeah, they could be simpler.  They both error-correct so that's one reason they're a bit larger.

Dragon__lance

  • Guest
[83+ BASIC] Compressors
« Reply #14 on: August 06, 2006, 11:04:00 am »
oooooo,i'd love to see the code for that kalan_vod :Dbiggrin.gif