Javascript Code Golf Game

Associate
Joined
16 Apr 2007
Posts
2,208
Hi Guys.
Ive been playing around with something I found from MancJS' github.
Basically its code golf e.g lowest number of chars wins.
http://www.hazy.xyz:1127 is the url for one Im currently hosting.
You play by uploading a file (enter as many times as you want it will just update your total.) with a function named play and return what its expecting.

e.g if the challenge was add world onto the input argument then all the file would need to contain is
function play(s){return s+'world'}

Anyone interested in playing?
 
Associate
OP
Joined
16 Apr 2007
Posts
2,208
Same.

I did a little test and now i cant figure out how to try again?
Tells me i need to enter an email address but says it's already taken if i use the same one again?

Your key is m0zv1zx stops other people using your email address but it doesnt store it in cookies or anything just url so without publicly posting your email use
Code:
http://www.hazy.xyz:1127/?email=emailehere&team=ocuk-touch&key=m0zv1zx

Pretty good with JavaScript, not so good with math. Never even heard of a sociable number :) Can't get my head around the algo.

I didnt either just googled it till I found some examples to test my algorithm with I use this to check my outputs vs what I think it should output
http://jsfiddle.net/kr9n4gj5/
 
Last edited:
Associate
OP
Joined
16 Apr 2007
Posts
2,208
Got it. :) Going to try golf it some more.
Gratz its amazing how much you can remove.

How do you get the key?

I'm getting the same 'email already taken' error now.
I get it from admin area
3m51345 is dr test and
tybfpax is gravy monster since you need email anyway I guess can be public :D. I didnt make the game "engine" but I might tweak it abit to stop this happening.
 
Associate
Joined
4 Feb 2011
Posts
580
Location
Halifax
No, it returns [1, 2, 4, 5, 10, 17, 20, 34, 68, 85, 170, 340, 3719, 7438, 14876, 18595, 37190, 63223, 74380, 126446, 252892, 316115, 632230].

Looks like I need to do some more reading.

Get divisors of number, sum them, add to array, get divisors of summed number, repeat until the summed number is the same as the original.
 
Soldato
Joined
28 Oct 2006
Posts
12,456
Location
Sufferlandria
No, it returns [1, 2, 4, 5, 10, 17, 20, 34, 68, 85, 170, 340, 3719, 7438, 14876, 18595, 37190, 63223, 74380, 126446, 252892, 316115, 632230].

Looks like I need to do some more reading.

This confused me as well.
The 4 numbers on the wikipedia are not 4 separate examples, they are 4 numbers in a series (1264460, 1547860, 1727636, 1305184)

So your array is the divisors of 1264460, you need to add them together to get 1547860 and repeat the process again. When you add up all the divisors of 1547860, you'll get 1727637. Keep going until the series starts repeating (indicating the input was a social number) or you get to 0 (indicating the input wasnt a social number*.

*I think :p
 
Back
Top Bottom