### Author Topic: Optimizing lists and matrices for save files.  (Read 2397 times)

0 Members and 1 Guest are viewing this topic.

• Posts: 295
• Rating: +20/-1
• Its 0x1A4 somewhere
##### Optimizing lists and matrices for save files.
« on: December 07, 2011, 10:42:38 am »
Im not sure if this has been posted before, so here goes.
Using iPart() and fPart(), you can save lists or matrices with 2 entries per cell. {1.1} rather than  {1,1}. Every 2 entries saves 9 bytes with this method.
Loading is as simple as iPart(L1(A)) for the first entry in a cell, and 10fPart(L1(A)) for the second (the 10 is there because fPart returns the decimal as a decimal.)

#### Hayleia

• Programming Absol
• Coder Of Tomorrow
• LV12 Extreme Poster (Next: 5000)
• Posts: 3367
• Rating: +393/-7
##### Re: Optimizing lists and matrices for save files.
« Reply #1 on: December 07, 2011, 10:47:47 am »
Yes, it is a very effective way to save space.
However, it depends
-If you prefer saving space in the executable rather than in the list
-If you store something else than a number between 0 and 10.

For everything else, it works very well
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

#### Deep Toaster

• So much to do, so much time, so little motivation
• LV13 Extreme Addict (Next: 9001)
• Posts: 8206
• Rating: +758/-15
##### Re: Optimizing lists and matrices for save files.
« Reply #2 on: December 07, 2011, 06:27:04 pm »
More generally, you can save up to 7 values between 0 and 99 in one element (one real number) in the form 0.AABBCCDDEEFFGG, where each pair of letters is a value to save. To get the xth value in variable Y, use iPart(E2fPart(YE[2x].
« Last Edit: December 07, 2011, 06:27:56 pm by Deep Thought »

#### ztrumpet

• The Rarely Active One
• CoT Emeritus
• LV13 Extreme Addict (Next: 9001)
• Posts: 5712
• Rating: +364/-4
• If you see this, send me a PM. Just for fun.
##### Re: Optimizing lists and matrices for save files.
« Reply #3 on: December 07, 2011, 06:36:59 pm »
More generally, you can save up to 7 values between 0 and 99 in one element (one real number) in the form 0.AABBCCDDEEFFGG, where each pair of letters is a value to save. To get the xth value in variable Y, use iPart(E2fPart(YE[2x].
Actually it's closer to 6 values, as TI squanders a digit's worth of precision if the number is 14 digits long in the fpart/ipart section.
If I'm wrong, please correct me!
Unfinished Projects:
 Elmgon 14% Basic Movement Demo Homescreen Game Pack 80% Basic Latest Release Cube Droid Saves the Galaxy 65% Axe Demo Detonate 70% Axe
Completed Projects:
Exodus | Midnight |Drifter | Axe Snake | Jump! | Factory Theta | Spider | Plot Drop | Papi Jump | Numb3rs | Nibbler | Boost | Duel Tile Map Editor | Homescreen Map Editor | Key Group Check | Oasis

• Posts: 295
• Rating: +20/-1
• Its 0x1A4 somewhere
##### Re: Optimizing lists and matrices for save files.
« Reply #4 on: December 07, 2011, 07:36:10 pm »
Now that is cool

#### Builderboy

• Physics Guru
• CoT Emeritus
• LV13 Extreme Addict (Next: 9001)
• Posts: 5673
• Rating: +613/-9
• Would you kindly?
##### Re: Optimizing lists and matrices for save files.
« Reply #5 on: December 07, 2011, 07:38:24 pm »
More generally, you can save up to 7 values between 0 and 99 in one element (one real number) in the form 0.AABBCCDDEEFFGG, where each pair of letters is a value to save. To get the xth value in variable Y, use iPart(E2fPart(YE[2x].
Actually it's closer to 6 values, as TI squanders a digit's worth of precision if the number is 14 digits long in the fpart/ipart section.

It does?  I believe it carries all 14 digits at all times without rounding, it just doesn't display them all when you use Disp or access on the homescreen

#### Deep Toaster

• So much to do, so much time, so little motivation
• LV13 Extreme Addict (Next: 9001)
• Posts: 8206
• Rating: +758/-15
##### Re: Optimizing lists and matrices for save files.
« Reply #6 on: December 07, 2011, 07:43:54 pm »
More generally, you can save up to 7 values between 0 and 99 in one element (one real number) in the form 0.AABBCCDDEEFFGG, where each pair of letters is a value to save. To get the xth value in variable Y, use iPart(E2fPart(YE[2x].
Actually it's closer to 6 values, as TI squanders a digit's worth of precision if the number is 14 digits long in the fpart/ipart section.
Oh right, it does. I've personally had trouble with it, but it doesn't always happen for some reason, and doesn't make sense to me anyway Keep it at six to be safe.
« Last Edit: December 07, 2011, 07:44:06 pm by Deep Thought »

#### ztrumpet

• The Rarely Active One
• CoT Emeritus
• LV13 Extreme Addict (Next: 9001)
• Posts: 5712
• Rating: +364/-4
• If you see this, send me a PM. Just for fun.
##### Re: Optimizing lists and matrices for save files.
« Reply #7 on: December 07, 2011, 08:59:09 pm »
More generally, you can save up to 7 values between 0 and 99 in one element (one real number) in the form 0.AABBCCDDEEFFGG, where each pair of letters is a value to save. To get the xth value in variable Y, use iPart(E2fPart(YE[2x].
Actually it's closer to 6 values, as TI squanders a digit's worth of precision if the number is 14 digits long in the fpart/ipart section.

It does?  I believe it carries all 14 digits at all times without rounding, it just doesn't display them all when you use Disp or access on the homescreen
Huh, what do I know?  I was trying to make a screenie proving you wrong and instead proved myself wrong.  I guess it's all in how the code is coded on a given day.  Personally, this was the first time I tried coding it with the 10^(-2I part.
« Last Edit: December 07, 2011, 09:19:56 pm by ztrumpet »
If I'm wrong, please correct me!
Unfinished Projects:
 Elmgon 14% Basic Movement Demo Homescreen Game Pack 80% Basic Latest Release Cube Droid Saves the Galaxy 65% Axe Demo Detonate 70% Axe
Completed Projects:
Exodus | Midnight |Drifter | Axe Snake | Jump! | Factory Theta | Spider | Plot Drop | Papi Jump | Numb3rs | Nibbler | Boost | Duel Tile Map Editor | Homescreen Map Editor | Key Group Check | Oasis