[CODE GOLF] Challenge #3 - Caesar Cipher
Binary_CoderLvl 2
- Edited
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.
ackvonhuelioLvl 41
https://studio.code.org/projects/gamelab/Hb6CQzpihO3TeZep9rrNKAkmrigXsTNtIxERIi8O9Jw/view
182
cut some corners, ugliest code ever
again if ur competing dont look i dont want people stealing my stuff
ackvonhuelioLvl 41
- Edited
uhhh made another one at 152
https://studio.code.org/projects/gamelab/GTF0YJiFfPbOTRtMILmXQt60Z1aF-hB3kIdCtIAprAY/view
dunno if it counts tho cuz i used some ideas from @Binary_Coder
idk, can you copy concepts?
VarrienceLvl 25
- Edited
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
RavageLvl 20
- Edited
ackvonhuelio You are encouraged to build upon others'!
And Varrience , you have to give us your code, you know... along with count...
RavageLvl 20
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!
ackvonhuelioLvl 41
Ravage
LMFAO
VarrienceLvl 25
- Edited
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
RavageLvl 20
ackvonhuelio What, Quandale Dingle? Did I do something wrong?
RavageLvl 20
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!...
Binary_CoderLvl 2
- Edited
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.