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.
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)
@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.
@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
@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.
@IsaacKing Yes, tested just now because I'm paranoid: https://manifold.markets/A/test-market-7
Fingers crossed... :)
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.
@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.
@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.
@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.