I'd like to pass two Snap! variables into a JavaScript function and return the value of the numbers added together
I can't seem to find such an example
I'd like to pass two Snap! variables into a JavaScript function and return the value of the numbers added together
I can't seem to find such an example
More generic, if you force the variable to being a number
.
Hyperized does not work for your problem...
Thank you
Is just completely forgotton how to get variables into the JS code.
My real use case isn't a simple sum
When I'm back home I'll tell you about it
I tried to produce all the combinations of + and * by constructing Lisp code e.g. (+ ( * 2 3) 4) of all the combinations and then using call(parse code()) to see what value they produce.
But it's too slow
So going to try re-writing it to use JS instead and see if its any quicker
I would consider that cheating though, this is for snap, not JS
Well, I was using Snap!s pseudo Lisp code which is already slightly cheating
I guess... anyone else have an opinion on this?
I've found those problems overcomplicated and feel like trying to do
Number(a)
simplified: +(a)
Advent of Code isn't Snap!-specific, though...
They probably just mean, it feels cheating if you're using 2 programming languages to solve the puzzle. However, I'd argue that it's not cheating, since it's still programming, and the only requirement is that you get a result (without using code from someone else). Heck, on a previous puzzle, many people (outside snap) used regex, which could be considered cheating.
I would say its cheating if youre posting your results on this forum whilist competing in a leaderboard with others using snap, yet using the wrong programming language. I have been doing aoc to test the limits of snap, to have fun, and partake in a friendly competition, not to be beaten because snap wasnt fast enough to do a computation and being beaten by
and of course if everyone was allowed using JS, then literally theres no point in using snap since its a lot slower.
Oh right I forgot that was a thing. I guess I'd agree that posting JS code there should be considered cheating.
in the topic or used in the leaderboard?
Leaderboard. I don't think the concept of cheating applies to the topic, which I construe as non-competitive in spirit. As in, you shouldn't be afraid to post your solution because you think it isn't as good as someone else's solution.
makes sense, but the only way to know if your solution actually works is to put it in, which adds your result to the leaderboard.
I think we're talking about two different things. There's the general AoC submission, which accepts any language, and then there's the Snap!-specific one that someone set up just for us. In the general one, JS isn't cheating; any language is okay.
the snap specific one doesnt detect that its snap, its just a private leaderboard, showing each others' results.
The way AoC handles private leaderboards, is basically the same as the global leaderboard, except that it just shows only the users who joined the leaderboard. There's no way for you to select which leaderboard to post your puzzle answer to. The leaderboards are really just a way to see how many puzzles each people completed, and how fast they did it (you go up higher on the leaderboard the faster you completed the puzzle (from the time it opens up), that's how it handles multiple people with the same amount of puzzles completed).
And to be honest, I don't think anyone really cares much about the leaderboard anyway. I sure don't.
I think I was the one who created the leaderboard, since I have the ability to delete it
So, okay, I guess people with JS code in their project should post to a JS leaderboard rather than to the Snap! one, just to keep @sathvikrias happy. :~)