Dismiss Notice
Hey Guest,
If you are interested in ghosting, the Ghosting Awards for January 2025 has just been announced:

Click here to check it out!

Code

Discussion in 'Anything and everything Free Rider' started by og_Cork, Mar 14, 2019.

Tags:
?

Should I bother doing further investigation?

  1. Yes

    87.1%
  2. No

    12.9%
  1. Rhodium

    Rhodium Well-Known Member Official Author

    Do you mean numbers for the x-y coordinates? Because those are just base-32 values
     
  2. og_Cork

    og_Cork Well-Known Member Official Author

    read tetra's post
     
    adsfasfa likes this.
  3. TheHexagon

    TheHexagon Member Official Author

  4. SeanTison

    SeanTison Casual Member Official Author

    max amount of friends, sorry
     
  5. ItsColinGuys

    ItsColinGuys Well-Known Member Official Author


    there are like 10000000000 of these threads so tldr
     
    og_Cork likes this.
  6. Hunt3r_26

    Hunt3r_26 Well-Known Member Official Author

    By my research it doesn't seem possible to edit a vehicles code in the code box as a vehicle is represented in the code as
    ##V
    but this code is a storage area kind of as the code does not change with different vehicles or time lengths
     
  7. should do more research
     
  8. og_Cork

    og_Cork Well-Known Member Official Author

    actually in APCSP right now during my senior year in highschool. We learned about number systems and how they work. As tetrationiscool mentioned earlier, its base-32. Now that I know how it works I might be able to code a simple track generator, svg to track generator, or image to track as well
     
    Deleted member 6703 likes this.
  9. BrandonBishop50

    BrandonBishop50 FRHD News Team Official Author

    No idea if these will help you in your quest - but I have a link to a thread explaining an image to track converter by MaxwellNurzia, and here is one explaining invisible lines, by Polygon which have since been patched.

    Note: not posting the link to the image to track converter because it is widely frowned upon - although if you believe it may help, and won't publish a track with it, I am willing to give you the link in DM

    edit: gave Polygon credit for invis line post
     
  10. og_Cork

    og_Cork Well-Known Member Official Author

    its more of a coding project rather than a free track generator for me. I might post a few converted memes but other than that not much
     
    Deleted member 6703 likes this.
  11. Calculus

    Calculus Community Developer Staff Member Administrator Ghost Moderator

    Awarded Medals
    That's what they all say.

    Bases 2 through 36 are simple, yes; however, trying to find out how a number is converted was a bit challenging. I couldn't find much online about base-10 to base-32 conversion. I did, eventually, find something useful, and I've created code, as well as a formula in math to accomplish base-10 to base-32 conversion:
    Code:
    f(x) = x - 32⌊ˣ⁄₃₂⌋
    
    or
    
    x mod 32
    
    Result:
    upload_2022-1-23_21-20-30.png

    I tried to make a recursive function/formula, but I don't know of any way to return an alphanumeric result in math, which is absolutely necessary when converting large numbers. I could, however, return the remainders via a multivariable function (not sure this works. I've never really used multivariable functions):
    Code:
    g(1) = 1; g(x) = (g(⌊x / 32⌋), x mod 32)
                            ^^^^^^^^^^^^^^
                                      VECTOR
    
    My brain hurts already. I'm not going to try and figure this out for y'all. Good luck;

    As tetrationiscool mentioned: there are the basic digits, 0-9, which would be used first. If the remainder is a number greater than 9, it'd start using letters a-v. Being that the first remainder of our input, 40, was 8, the last character in the string would be 8. The next remainder you'd have to get is the quotient of x/32 floored. You'd continue this process until your number, in this case, 40, is zero or smaller. 40/32 is 1.25; floored, it's 1. 1 mod 32 is 1. So 1 would be added to the start of the string. That becomes 18. 1 / 32 is obviously zero or smaller, so that's where you'd stop. End result: 40 in base-32 is 18.

    I'm sure that made no sense, so if you understand code, perhaps you'll get a better understanding reading this:
    C++ (open)

    PHP:
    class Base32 {
        public:
            static 
    std::string dict;
            static 
    std::string encode(int number) {
                
    std::string result "";
                
    bool negative false;
                if (
    number 0) {
                    
    negative true;
                }

                
    number abs(number);
                do {
                    
    result Base32::dict[fmod(floor(number), 32)] + result;
                    
    number /= 32;
                } while(
    number 0);

                if (
    negative) {
                    
    result "-" result;
                }
      
                return 
    result;
            }

            static 
    int decode(std::string str) {
                
    int result 0;
                
    int negative 1;
                if (
    str.rfind("-"0) == 0) {
                    
    negative = -1;
                    
    str str.substr(1);
                }

                for(
    charletter str) {
                    
    result result 32 Base32::dict.find(letter);
                }

                return 
    result negative;
            }
    };

    std::string Base32::dict "0123456789abcdefghijklmnopqrstuvwxyz";

    JavaScript (open)

    PHP:
    class Base32 {
        static 
    dict "0123456789abcdefghijklmnopqrstuvwxyz";
        static 
    encode(number) {
            
    let result "";
            
    let negative false;
            if (
    number 0) {
                
    negative true;
            }
          
            
    number Math.abs(number);
            do {
                
    result Base32.dict[Math.floor(number) % 32] + result;
                
    number /= 32;
            } while(
    number >= 1);

            if (
    negative) {
                
    result "-" result;
            }

            return 
    result;
        }
      
        static 
    decode(string) {
            
    let result 0;
            
    let negative 1;
            if (
    string.startsWith("-")) {
                
    negative = -1;
                
    string string.slice(1);
            }
          
            for (const 
    letter of string) {  
                
    result += Base32.dict.indexOf(letter);
                
    result *= 32;
            }

            return 
    result 32 negative;
        }
    }

    P.S. I forgot about the modulo operator.
     
    adsfasfa likes this.

Share This Page