Take the 2-minute tour ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

This is a pretty cool CodeGolf challenge in the sense that you're only going to have a limited amount of time to do it. You need to build a program that "mines" StackOverflow unicoins. In order to do this, you need to perform just two HTTP requests. I'm not going to say how, to add to the fun.

The first person to do this gets a -10 on their score. Good luck! Also, if your doing this in JavaScript or similar, you don't need to account for the target browser's XSS, etc. prevention.

share|improve this question

closed as off-topic by Geobits, manatwork, Timtech, TheDoctor, ProgramFOX Apr 2 at 13:56

  • This question does not appear to be about programming puzzles or code golf within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

7  
Where by "only going to have one day to do it" you mean "it's too late to test if you live anywhere in the Eastern hemisphere"? –  Peter Taylor Apr 1 at 22:26
    
@PeterTaylor Yup :) EDIT: lol I fixed it –  Taconut Apr 1 at 22:30
2  
-1 for unfairness - I already have no access to the Unicoins at the time you posted this challenge. –  ace Apr 2 at 5:59
5  
This question appears to be off-topic because results cannot be reliably tested. –  Geobits Apr 2 at 12:55
    
Unicoins are gone, bro –  TheDoctor Apr 2 at 13:37
add comment

1 Answer 1

Javascript, 104 (114 chars - 10 bonus)

All due credit here. Simply posting this to get the "first answer" -10 bonus ;-).

p='$.post("/unicoin/'
setInterval(p+'rock",function(o){'+p+'mine?rock="+o.rock,StackExchange.options.user)})',2e4)

setInterval accepts both functions and strings of code. After susbtituting the variable p, the following gets executed every 20 seconds:

$.post("/unicoin/rock", function(o) {
    $.post("/unicoin/mine?rock=" + o.rock, StackExchange.options.user)
} 

Edits are welcome. I don't know well enough to really competitively golf this.

share|improve this answer
    
Save the url in a var ( the /unicoin/ part ) and you shave off some bytes. Also delete all the un-needed whitespace. AND you are using jQuery and you make no references about it. AND reduce the var names. And you should mark it as a community wiki –  Ismael Miguel Apr 1 at 22:29
    
You can also reduce it by one character by changing the 15 to a one-digit number –  Jwosty Apr 1 at 22:59
    
It has to be 15 or higher. If its not, it'll give you an interrupted error. What about rounding up to 2e2? –  Taconut Apr 1 at 23:29
    
Passing a string of code to setInterval manages to save a bunch of characters. Also, $.post allows to specify a callback function (no need for .done()) and we can include the entire object StackExchange.options.user in the POST request instead of extracting the fkey value from it (which is the single one we actually need). –  Dennis Apr 2 at 4:46
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.