CIB

A forum where you can announce your awesome project(s).

Moderator: MaxCoderz Staff

Post Reply
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

CIB

Post by kalan_vod »

After the last time I posted a new project I thought I wouldn't post a new one, but I am going to give it one more shot...
Some are aware of this but I thought I would share it a little more people.

[quote="Old Update"]About: Compression In Basic
I started playing around with compression with basic (no way :shock: ), this is atm just for my game Tank. It will only work with a closed area.

How it works:
It takes a Matrix and compresses it in a format of the number of times the number appears and decimal places of what the number is. The compressed matrix is in a form of list (L1), and the first two spots are the dimensions.

Example:

Code: Select all

/matrix data - 16x24
19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 
19.1 8 8 8 8 8 8 8 8 8 8 8 8 8 22.2 33.2 8 8 8 8 8 8 8 19.1 
19.1 8 8 8 8 8 8 19.1 8 8 8 8 8 8 8 8 8 8 8 34.2 21.2 8 8 19.1 
19.1 8 19.1 8 8 8 8 19.1 8 8 8 8 8 8 8 8 8 8 8 22.2 33.2 8 8 19.1 
19.1 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 19.1 
19.1 8 8 8 18.2 18.2 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 19.1 
19.1 8 8 8 8 8 8 8 34.2 15.2 15.2 15.2 15.2 15.2 15.2 21.2 8 8 8 8 8 8 8 19.1 
19.1 8 8 8 8 8 8 8 20.2 8 8 19.1 8 8 8 20.2 8 8 8 8 8 8 8 19.1 
19.1 8 8 8 8 8 8 8 20.2 8 8 8 19.1 8 8 20.2 8 8 8 8 8 8 8 19.1 
19.1 8 8 8 8 8 8 8 22.2 15.2 15.2 15.2 15.2 15.2 15.2 33.2 8 8 8 8 8 8 8 19.1 
19.1 8 8 8 8 18.2 8 8 8 8 8 8 8 8 8 8 8 8 13.2 8 8 8 8 19.1 
19.1 8 8 8 8 18.2 18.2 8 8 8 8 8 8 8 8 8 8 13.2 13.2 8 8 8 8 19.1 
19.1 8 18.2 18.2 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 13.2 13.2 8 8 19.1 
19.1 8 8 18.2 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 13.2 8 8 8 19.1 
19.1 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 19.1 
19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1 19.1→[A]

Code: Select all

/Once converted
{16,24,25.191,13.08,1.222,1.332,7.08,2.191,6.08,1.191,11.08,1.342,1.212
,2.08,2.191,1.08,1.191,4.08,1.191,11.08,1.222,1.332,2.08,2.191,22.08,2.191
,3.08,2.182,17.08,2.191,7.08,1.342,6.152,1.212,7.08,2.191,7.08,1.202,2.08
,1.191,3.08,1.202,7.08,2.191,7.08,1.202,3.08,1.191,2.08,1.202,7.08,2.191
,7.08,1.222,6.152,1.332,7.08,2.191,4.08,1.182,12.08,1.132,4.08,2.191,4.08
,2.182,10.08,2.132,4.08,2.191,1.08,2.182,15.08,2.132,2.08,2.191,2.08,1.182
,15.08,1.132,3.08,2.191,22.08,25.191→L1
The Matrix data is 3467b and the compressed list is 768b, which gives a compression rate of 77.8%. Now once inside a program you could do the Ans trick where you type a number that is used most often above the matrix and place Ans instead of that number inside the list.

Code: Select all

2.191
{16,24,25.191,13.08,1.222,1.332,7.08,Ans,6.08,1.191,11.08,1.342,1.212,2.08
,Ans,1.08,1.191,4.08,1.191,11.08,1.222,1.332,2.08,Ans,22.08,Ans,3.08,2.182
,17.08,Ans,7.08,1.342,6.152,1.212,7.08,Ans,7.08,1.202,2.08,1.191,3.08,1.202
,7.08,Ans,7.08,1.202,3.08,1.191,2.08,1.202,7.08,Ans,7.08,1.222,6.152,1.332
,7.08,Ans,4.08,1.182,12.08,1.132,4.08,Ans,4.08,2.182,10.08,2.132,4.08,Ans
,1.08,2.182,15.08,2.132,2.08,Ans,2.08,1.182,15.08,1.132,3.08,Ans,22.08,25.191→LÂÂÂ
Last edited by kalan_vod on Mon 21 Aug, 2006 6:33 pm, edited 1 time in total.
threefingeredguy
Calc King
Posts: 2195
Joined: Sun 27 Mar, 2005 4:06 am
Location: sleeping
Contact:

Post by threefingeredguy »

Would it not be much more space effecient to use strings instead of lists?
Image
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

The strings would provide a greater compression ratio, and atm I am working on something of the such.
threefingeredguy
Calc King
Posts: 2195
Joined: Sun 27 Mar, 2005 4:06 am
Location: sleeping
Contact:

Post by threefingeredguy »

Jolly good, jolly good.
Image
User avatar
dysfunction
Calc Master
Posts: 1454
Joined: Wed 22 Dec, 2004 3:07 am
Location: Through the Aura

Post by dysfunction »

Wouldn't strings be much slower though?
Image


"You're very clever, young man, but it's turtles all the way down!"
User avatar
kalan_vod
Calc King
Posts: 2932
Joined: Sat 18 Dec, 2004 6:46 am
Contact:

Post by kalan_vod »

dysfunction wrote:Wouldn't strings be much slower though?
Not totally sure, as you can store the string into Y1 and then that to L1. Which would allow for greater compression, but a little longer loading.
Post Reply