Code golf: Will someone post <=70 characters of Javascript code that I can use to resolve this market to YES?
Basic
3
Ṁ712
resolved Mar 30
Resolved
YES

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

Post Javascript code in the market comments. I will run each piece of code that's 70 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
Ṁ1,000
and
S3.00
Sort by:

Okay this one seems to be robust to comments and also to position:

i=4;setInterval(b=>b(".ring-inset").at(-[1,2,6,4][--i]).click(),9,$$)

After resolving it will bring up an undismissable prompt to buy more mana (until you refresh the page) but it should be harmless.

@A This is getting extremely cursed.

Should I be worried about it doing something irreversible with my balance?

predictedYES

@IsaacKing Hasn't done anything bad for me! If you want to double-check you can check that $$(".ring-inset").at(-4).innerText returns "Resolve" and likewise for the rest of the values (-4, -6, -2, -1, 0 in that order, after clicking the corresponding buttons) to make sure the buttons it picks don't do anything problematic.

Why is there a 0?

predictedYES

@IsaacKing It runs past the end of the array and hits undefined. (Previous iterations had a check to prevent that, but I ran out of characters this time and it's not strictly necessary)

@A Do you mind briefly explaining how your code works?

predictedYES

@levifinkelstein Sure! It sets a timer for every 9 milliseconds. On every tick of the timer, it gets the next element of the array of button positions (in backwards order, for no particular reason), and clicks the button at that index. We use negative indices so that it counts backwards from the end of the button list, which makes it stable regardless of whether the SELL button appears, and we select the buttons using the "ring-inset" CSS class since that excludes the comment menu drop down.

Happy to clarify more if there's a specific section of the code you're wondering about!

i=4;setInterval(b=>i&&b("button").at(-[2,10,14,13][--i]).click(),9,$$)
predictedYES

@A Actually no that doesn't work if you don't hold shares, let me adjust it...

predictedYES

@A Ah wait maybe it does, I think maybe it depends whether anyone has positions in the market and whether you've previously traded in the market? Anyways I guess since we're cooperating this time you might as well give it a try and we can adjust the offsets as needed.

If you're trying to validate that it won't do anything crazy before you officially run it, you might want to change the timeout interval from 9 to 3000 or something for testing purposes. I've been doing it that way sometimes -- it makes it way easier to catch it when something is going wrong before it does something crazy.

predictedYES

@A Oh hmmm actually I think the comments are breaking this -- will revise accordingly

@A I just ran this code and it reported your comment.

predictedYES

@IsaacKing Lol that's some good poetic justice

Not an attempt but if you knew the coordinates

Document.createvent.initmouseevent(x,y)

Of course Java has massive boilerplate that increases the characters but otherwise you could solve this in 40 characters. I don't think less is possible.

Nice! We also get multiple tries now, right? (Within reason, I suppose)

@A Yep

Related questions

© Manifold Markets, Inc.Terms + Mana-only TermsPrivacyRules