Code golf: Will someone post <=63 characters of Javascript code that I can use to resolve this market to YES?
2
34
90
resolved Apr 4
Resolved
YES

Sequel to /IsaacKing/code-golf-will-someone-post-64-char

Post Javascript code in the market comments. I will run each piece of code that's 63 characters or less and doesn't use fetch() or another way of bringing in external code in my JS console on this page. (Including from comments.) If this results in this market resolving to YES, so be it. If the market is still unresolved by the close date, it resolves to NO.

If I suspect that your code will do something that I do not want it to do, such as resolve this market to NO or send you all of my mana, I will not run it. (And if that fails, I reserve the right to resolve this market N/A.)

As a change from previous markets, I am now in full cooperation with the golfers in attempting to resolve this market YES. I will provide any relevant information they ask for, such as my browser environment and any error messages or other results of running a certain code snippet. And I will no longer try to foil their plans, such as by resizing the window to change the page layout. (I do however reserve the right to refuse certain requests, such as a request to buy or sell shares in order to change what buttons exist.)

Get Ṁ200 play money

🏅 Top traders

#NameTotal profit
1Ṁ52
Sort by:

Alright, anyone wanna give me a guess as to a number of characters that will actually be challenging, so I can stop giving away so much mana?

predicted YES

@IsaacKing I think I have a solution in 58 chars currently, assuming your cooperation on the button alignment.

predicted NO

beep boop, did Isaac try A's code?

bought Ṁ50 of YES

Like the previous, the solution will depend on whether you hold shares?

@A I won't.

bought Ṁ300 of YES

@IsaacKing Cool, in that case:

i=0;b=$$;setInterval('b(".font-md")[[3,6,10,13][i++]].click()')
predicted NO

@A hmm, you don't need any delay between the button presses?

predicted YES

@levifinkelstein Right, not necessarily. It doesn't work if you get rid of the setInterval completely though, because that's needed to basically cede priority to let the UI update in between clicks.

predicted NO

@A Do you know of any hacky way to cause delay anyways? Perhaps calling some very expensive function.

predicted YES

@levifinkelstein I guess you could call alert() or something which blocks until the user clicks okay? Are you just trying to slow it down so it doesn't do too much damage when it goes wrong or do you have a different use case for the delay?

predicted NO

@A I had in mind letting the UI update inbetween clicks, to avoid using setInterval

predicted YES

@levifinkelstein I don't know any shorter way to do that than setInterval. Maybe you could try something with async? Or setTimeout or a different function with an async callback, but I doubt it will end up being shorter. I've thought about this approach before and this one was the shortest I could find but if you find something better go for it! :)

predicted NO

@A can you tell me why you need to define redefine $$ as opposed to using it directly?

predicted YES

@levifinkelstein In Chrome, $$ doesn't seem to work inside lambdas unless you redefine it. Not sure why exactly, some scoping thing I guess. In Firefox it's not the case.

predicted YES