Code golf: Will someone post <=100 characters of Javascript code that I can use to resolve this market to YES, without fetching external code?
Basic
20
Ṁ8395
resolved Feb 3
Resolved
YES

Sequel to /IsaacKing/code-golf-will-someone-post-100-cha

Post Javascript code in the market comments. I will run each piece of code that's 100 characters or less and doesn't use fetch() or another way of bringing in external code in my JS console on this page. 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.)

Each person gets one attempt.

Get
Ṁ1,000
and
S3.00
Sort by:
predicted YES

Could you add this market with a tag of "code golf"? Would be easier to organize all the code golfs here

Some thoughts as a code-golfer: You could use a 2:1 character packer such as https://xem.github.io/obfuscatweet/ in order to pack ~113 printable ascii characters into 100 characters (@IsaacKing, if you run this again or a different codegolf market I would suggest specifying "bytes" to avoid this issue). This certainly seems very possible, and could probably be done in less than 90. I'm going to have a look at it tomorrow and see if i can make something more robust and/or shorter than the below comment (which itself I believe can be golfed to 89 bytes)

predicted YES

@JoKing Nice! Yeah I have no doubt it can be golfed shorter, I stopped golfing once it got to <100. For starters, "filter" could probably be changed to "map" and the RegEx probably would work even if it was a bit less precise.

predicted YES

@JoKing This market and @IsaacKing's previous market - these have introduced me to code golfing - and i'm so excited now. I've been going over the stackexchange and it's so fun! Looking forward to the next one here

@A Ha, I didn't actually notice that you weren't using the result of filter. I was thinking more along the lines of using $$ directly since you only use b once and how condition&&x.click()||(x.disabled=1) could be condition?x.click:x.disabled=1.

@firstuserhere Great to hear it! I'm actually a moderator on the codegolf stackexchange. Feel free to drop by the chatroom and say hi. I'd also recommend the website code.golf as a good place to test your skills, though the solutions are kept private

predicted YES

@JoKing Hmm using the $$ directly inside of the lambda was working for me in Firefox but not Chrome, I'm not sure why. But yeah maybe something along those lines could work.

predicted YES

@JoKing oh that's awesome! I'd love to do that. Thanks for the recommendation

b=$$;setInterval(a=>b("button").filter(x=>x.innerText.match("ES|ve")&&x.click()||(x.disabled=1)),9)

predicted YES

@firstuserhere @IsaacKing Please run this soon before it breaks again?

predicted NO

@A Confirming you believe this is still valid if I were to run it now?

predicted YES

@IsaacKing Yes, tested just now because I'm paranoid: https://manifold.markets/A/test-market-7

Fingers crossed... :)

@A And remember to refresh the page afterwards so it stops running

@A Good job!

And to answer everyone's questions about why the previous attempts weren't working, it was not the buttons moving it around, it was $$ being undefined inside a function as

@A mentioned above.

predicted YES

@IsaacKing Nice! Yeah it was a mistake for me to originally test only in Firefox, I think the first snippet never worked in Chrome. Later it stopped working even in Firefox because of the UI tweaks (something about the button navigation logic that was causing it to click back and forth instead of making progress). Oh well, in the end I ended up making more profit than if it had worked the first time -- maybe I should write bugs more often lol.

Would someone repost the following comment please?

```

b=$$;setInterval(a=>b("button").filter(x=>x.innerText.match("ES|ve")&&x.click()||(x.disabled=1)),9)

```

I put in a limit order for some shares of NO at 97 so you can share in the profits.

predicted YES

@A (the part in between the ```)

setInterval(a=>$$("button:not(.rounded-3xl)").filter(x=>x.innerText.match("YES|lve")&&x.click()),99)
predicted YES

@A Please be careful to refresh the page after you finish running this! Otherwise it will stay active and if you visit any other unresolved markets they'll get resolved YES too.

@A @IsaacKing Please let me know if there is some reason that you can't run this.

predicted YES

@A @IsaacKing Reminder to run this?

predicted NO

@A Sorry, didn't check Manifold for a while.

@IsaacKing Okay no worries, as long as you didn't forget about it :)

predicted NO

@A I have run the code. :)

predicted YES

@IsaacKing Ugh, they changed the UI since when I posted it... 😭

@A Hmm, that sounds like it's my fault for not running it for 2 weeks. Anyone think it would be unfair for me to give @A another shot due to my disappearance?

@IsaacKing Well here's a fixed/updated version in any case:

b=$$;setInterval(a=>b("button").filter(x=>x.innerText.match("ES|ve")&&x.click()||(x.disabled=1)),9)

If we have at least 1 YES voter willling to repost it for the free mana then we can avoid any potential controversy.

Related questions

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