0 Members and 2 Guests are viewing this topic.

10fPart(10^-N[A]

Encoding data with primes and properties of numbers can have some pretty interesting effects.

This sounds like a very intriguing new way to save memory! You better watch out though, since even though the maximum value for a number in a matrix is 10^99, the numbers are stored in floating point format. What this means is that even though you can store very large numbers, the precision of them will only be about the last 14 digits or so (depending on your calculator model). This will result in extremely large numbers being seemingly divisible by numbers they cannot be divisible by. For example, a large enough power of 2 will return 0 when you ask for remainder 3.

Another method that you might be interested in works like this:Say you have 10 different tiles and numbers are stored with 14 digits of precision. You can then store each map layer with the nth digit in the number. To access the map in TI-BASIC code:Code: [Select]10fPart(10^-N[A]If you aren't familiar with TI-BASIC, fPart( simply grabs the decimal part of a number (leaving off the integer part). If the language you are using doesn't have that, there is probably some equivalent to a floor() function (round down to the nearest integer) and you would essentially do #-floor(#).If you have M different tiles, you can theoretically store up to floor(14/log(M)) different maps in a single matrix element, this way. However, I would go with 1 less than that to avoid precision problems. Your code for extracting a given matrix would be to replace the 10 in the above code with M.I hope to see more ideas Encoding data with primes and properties of numbers can have some pretty interesting effects.

Quote from: Xeda112358 on March 27, 2013, 01:35:50 pmAnother method that you might be interested in works like this:Say you have 10 different tiles and numbers are stored with 14 digits of precision. You can then store each map layer with the nth digit in the number. To access the map in TI-BASIC code:Code: [Select]10fPart(10^-N[A]If you aren't familiar with TI-BASIC, fPart( simply grabs the decimal part of a number (leaving off the integer part). If the language you are using doesn't have that, there is probably some equivalent to a floor() function (round down to the nearest integer) and you would essentially do #-floor(#).If you have M different tiles, you can theoretically store up to floor(14/log(M)) different maps in a single matrix element, this way. However, I would go with 1 less than that to avoid precision problems. Your code for extracting a given matrix would be to replace the 10 in the above code with M.I hope to see more ideas Encoding data with primes and properties of numbers can have some pretty interesting effects.That's a very interesting method! There are only two small downsides it really has: one is being limited to a maximum of 10 features before it reduces your storage capability by half. But when you use two decimal places for each tile instead of 1 you can store as many as 100(!) different tiles, allowing you to store maps that are more artistic, while still reducing your storage by a factor of 6 (I take 12 decimal places as the limit just to make sure I don't go over it, otherwise the factor would be 7 (14/2)). The second is that this storage method is far less efficient when you use it with maps that don't need 10 different features, but even so it is more efficient than my method since it allows for up to 13 maps to be stored in a single matrix as opposed to my 12 maps which is only in the best-case-scenario of using only 1 terrain feature.Hmmm... I think I might change the first post a bit to make this thread more of a discussion for different methods to compress maps, and perhaps even to simply 'compression methods' if the need to discuss compression for data other than maps arises.