Javascript Code Golf Game

Soldato
Joined
28 Oct 2006
Posts
12,456
Location
Sufferlandria
But after reading the golf source, that probably won't work :D

Haha, I did try something similar with the correct values in the array. It works but takes more than 200 characters to type out the whole array :p

What are you using as the exit clause for your main loop?
Do you really need that if you know exactly how many times to loop?
 
Associate
Joined
4 Feb 2011
Posts
580
Location
Halifax
Haha, I did try something similar with the correct values in the array. It works but takes more than 200 characters to type out the whole array :p

What are you using as the exit clause for your main loop?
Do you really need that if you know exactly how many times to loop?

I just return when the original number is the same as a calculated sociable number, which makes it an amicable number. Also down to 119 109 107.
 
Last edited:
Soldato
Joined
28 Oct 2006
Posts
12,456
Location
Sufferlandria
I just return when the original number is the same as a calculated sociable number, which makes it an amicable number. Also down to 119 109.

That's what I had first as well.

The way i'm doing it now, like i said before, is pretty much cheating.
I have worked out what gets passed to my function (1***6) and written code that works specifically with that value - i know exactly how many loops are needed, i know that my calculation of divisors isnt correct but it works, so i can get away with bad code because it happens to work for this specific scenario. Any other value passed to my function would crash it.
 
Last edited:
Associate
Joined
4 Feb 2011
Posts
580
Location
Halifax
That's what I had first as well.

The way i'm doing it now, like i said before, is pretty much cheating.
I have worked out what gets passed to my function (1***6) and written code that works specifically with that value - i know exactly how many loops are needed, i know that my calculation of divisors isnt correct but it works, so i can get away with bad code because it happens to work for this specific scenario. Any other value passed to my function would crash it.

I originally tried returning a request from my server using node, since it evals the code :D. Turned out the request code was longer than my generator. When does this end?
 
Associate
OP
Joined
16 Apr 2007
Posts
2,208
I originally tried returning a request from my server using node, since it evals the code :D. Turned out the request code was longer than my generator. When does this end?

It never ends.
Touch id says thats almost cheating but your not winning anyway.
Few other ones I set up a while ago if you wanna play.
www.hazy.xyz:1122
www.hazy.xyz:1123
www.hazy.xyz:1124

List of changes to do to the game are to allow more "holes" in 1 game
Change the validation to check for multiple inputs vs multiple outputs at the moment as you have seen it just takes 1 input and checks against 1 output.
Change the way keys/tokens are used.
 
Soldato
Joined
28 Oct 2006
Posts
12,456
Location
Sufferlandria
I originally tried returning a request from my server using node, since it evals the code :D. Turned out the request code was longer than my generator. When does this end?

Haha, i thought about hosting a javascript file on my own server with the calculation function in it and just trying to use the play() function to call that.
Also tried setting up a webservice but I dont know enough about javascript to do either of these :(
 
Associate
OP
Joined
16 Apr 2007
Posts
2,208
You might also want to change the default admin passwords, lol.
Was wondering how long it would be till someone found them :D. Im mid way through making my changes having few issues as never used node before and time constraints but nodetool for VS makes it very easy to work with node in VS.
 
Back
Top Bottom