Author |
Message |
|
Spyderbyte
Advanced Member
Joined: 29 May 2003 Posts: 372
|
Posted: 14 Jun 2003 05:43:02 pm Post subject: |
|
|
Is a string the smallest way to encode a series of numbers into a program? I don't need to be able to write back to it, I just need to have a list of a lot (I'm thinking 96) of numbers (1- that my program can read from.
A string is quite a bit smaller than a list, but it's still pretty massive.
Maybe some kind of an algorithim? It seems like kind of a waste to only need 3 bits out of every bite.
Any help would be greatly appreciated.
Thanks!
Spyderbyte |
|
Back to top |
|
|
Adm.Wiggin aka Tianon
Know-It-All
Joined: 02 Jun 2003 Posts: 1874
|
Posted: 14 Jun 2003 06:06:10 pm Post subject: |
|
|
correction, if u use a list, then it is 3 bits, for every 9 bytes! ouch! |
|
Back to top |
|
|
yugniht
Member
Joined: 29 May 2003 Posts: 167
|
Posted: 14 Jun 2003 07:33:24 pm Post subject: |
|
|
you could come up with some crazy algorithm to compress it or something that may save a few bytes but take longer or use a string. I'd just use the string. |
|
Back to top |
|
|
Tyler
Advanced Member
Joined: 29 May 2003 Posts: 352
|
Posted: 14 Jun 2003 07:50:27 pm Post subject: |
|
|
A string wouldn't be a bad idea, because it's fast, and you could archive it when you exiting the program! That would only add 100 bytes or so to the archive and temporary RAM storage. If you are just going to read the numbers, you a polar graphing varaiable too! (In the VARS menu)
Hope it helps, Tyler |
|
Back to top |
|
|
Spyderbyte
Advanced Member
Joined: 29 May 2003 Posts: 372
|
Posted: 14 Jun 2003 10:44:26 pm Post subject: |
|
|
Quote: correction, if u use a list, then it is 3 bits, for every 9 bytes! ouch!
Yeah I knew a list was completely out of the question.
Quote: A string wouldn't be a bad idea, because it's fast, and you could archive it when you exiting the program! That would only add 100 bytes or so to the archive and temporary RAM storage. If you are just going to read the numbers, you a polar graphing varaiable too! (In the VARS menu)
Yeah but it was the massive line storing "123456...."->Str1 that I was trying to avoid. I guess it's not that important though, I'll see what I can do.
Thanks!
Spyderbyte |
|
Back to top |
|
|
Darth Android DragonOS Dev Team
Bandwidth Hog
Joined: 31 May 2003 Posts: 2104
|
Posted: 15 Jun 2003 07:44:27 am Post subject: |
|
|
here:
Code: "{->Str2
For(A,1,dim(LLIST
LLIST(A->N
prgm(theta)N2S
Str2+Str1+",->Str2
End
simple decompress:
Code: expr(Str2->LLIST
for my number-2-string program (prgm(theta)N2S),
tell me to post it and i will.
Last edited by Guest on 15 Jun 2003 07:45:39 am; edited 1 time in total |
|
Back to top |
|
|
Darth Android DragonOS Dev Team
Bandwidth Hog
Joined: 31 May 2003 Posts: 2104
|
Posted: 15 Jun 2003 08:10:55 am Post subject: |
|
|
here is the code anyways:
Code: " ->Str1
fPart(N->A
iPart(N->C
abs(N->B
While iPart(B>1
.1B->B
End
Repeat not(B
If Str1<>"(space)
Then
If A and A=fPart(B) and expr(Str1)=iPart(N
Str1+".->Str1
End
B-iPart(B->B
10B->B
Str1+sub("0123456789",iPart(B)+1,1->Str1
If length(Str1)>1 and sub(Str1,1,1)="(space)
sub(Str1,2,length(Str1)-1->Str1
End
If N<0
Str1+"(negative symbol)->Str1
DelVar AWhile N and not(fPart(.1N
.1N->N
A+1->A
End
A->C //this line and the following while loop can be left out if u do not need N anymore
While C
10N->N
End
While A-1(is greater than or equal to sign (>=))1
Str1+"0->Str1
A-1->A
End
sub(Str1,1,length(Str1)-1->Str1
note: if u use this code give me some credit just as im giving credit to jbirk for helping me with my zero detection code (detects ending zeros on the end of whole numbers (i.e. 10) |
|
Back to top |
|
|
Spyderbyte
Advanced Member
Joined: 29 May 2003 Posts: 372
|
Posted: 15 Jun 2003 11:41:13 am Post subject: |
|
|
Thanks, but I was planning to start out with a string anyway. Like I said, it was the big line storing "12345..."->Str1 that I cared about.
I guess 100 bytes or so isn't too bad.
Spyderbyte |
|
Back to top |
|
|
Pascal
Advanced Newbie
Joined: 24 May 2003 Posts: 76
|
Posted: 21 Jun 2003 03:44:10 pm Post subject: |
|
|
IF it was a serise of 1s and 0s on a strink, then I can give you a compressio routine I created that does 80% compression regardless of composition! |
|
Back to top |
|
|
Spyderbyte
Advanced Member
Joined: 29 May 2003 Posts: 372
|
Posted: 21 Jun 2003 08:00:06 pm Post subject: |
|
|
Thanks for the offer, but it's 1-8.
Spyderbyte |
|
Back to top |
|
|
Darth Android DragonOS Dev Team
Bandwidth Hog
Joined: 31 May 2003 Posts: 2104
|
Posted: 21 Jun 2003 09:36:44 pm Post subject: |
|
|
pascal, could u edit it so that it un/compresses a pic into a string and put a link?
i.e.: Code: [data]->Str0
1:asm(prgm(theta)piccomp
RecallPic 0
|
|
Back to top |
|
|
|