• Discussion
  • [CODE GOLF] Challenge #3 - Caesar Cipher

Edit: new function uses 182 characters, matching @ackvonhuelio’s response.
function c(s,k){t="";for(i=0;i<s.length;i++){n=s.charCodeAt(i);x=n;if((n>64&&n<91)||(n>96&&n<123)){x+=k;x-=26*(n<91&&x>90);x-=26*(n<123&&x>122);}t+=String.fromCharCode(x);}throw t;}

Also, I made a leaderboard to keep track of who’s winning.

    ackvonhuelio well I'd say it's fine so long as it isn't the exact same solution mine is a little different though per restrictions of CDO console.... it's not like we have much to work with here so you can't blame us for using similar strategy's since there basically the only way to get lower

      ackvonhuelio You are encouraged to build upon others'!
      And Varrience , you have to give us your code, you know... along with count...

        Binary_Coder A few things about the leaderboard (found out how to get to it now). First off, you should NEVER put your data in online data tables if only the owner is meant to change them. For example, I changed your pfp to Quandale Dingle. Lists work just as fine! In fact, I would put the names in a dictionary for MUCH easier access, rather than using indices: {Varrience:{wins:2,pfp:link}, Letti:{etc}} Also... I participate from time to time as well! And finally, you should (once you take off online data) DEFINITELY publish this! It could motivate people to come onto the forum!

          well here's my solution gave up on making it better so it'll do

          // 135 ok this one was way too close for comfort
          function f(r,o){for(i in n="",r)n+=(c=r.charCodeAt(i))>64&&c<91||c>96&&c<123?String.fromCharCode((c-(96&c)+o)%26+(96&c)):r[i];return n}

          Awards

          • â’¸ 1 from Ravage
          • â’¸ 1 from Ravage
            Comment: l ?
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: g o
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n
          • â’¸ 1 from Ravage
            Comment: n

            Weird, @Binary_Coder didn't respond to my comment - maybe mentioning? You should really try to change it, you can do very nasty stuff with it as it is. Also, I participate in challenges sometimes, and it would be a very good idea to publish the leaderboard (with a link to the forum) so others are motivated to join!...

              Ravage I saw it, just didn't get a chance to respond. Originally I was going to use a dictionary, but changed to data tables so I could edit it on mobile if necessary. And I wasn't sure people would like the idea of a leaderboard so I didn't put a lot of work into it.

              Here's the new leaderboard. I'll update it and publish it every time a challenge ends.

              Chat