40
5
Write a program/function that returns the vote count of its own Stack Exchange answer at the time of its execution.
- Your program/function may access this page (codegolf.stackexchange.com/questions/82609) off the internet, however:
- Your program/function may not accept any user input and
- The use of URL shorteners is not allowed
- Your program/function may use only its own source as a reference point to its vote count (for example: no referencing strings of text in its contained answer but not in its own source)
- Your program/function must output its own vote count and only its own vote count (for example: no returning all vote counts on this page)
This is code-golf, shortest code wins.
perl -e'($_)=`curl -s http://api.stackexchange.com/2.2/posts/123?site=codegolf`;/score":(\d+)/&&print$1'
looks like it should work, but doesn't. But maybe someone can use that. – msh210 – 2016-06-10T21:28:48.2737To everyone else who's trying and failing to use the API: It serves the response gzip encoded, even if the client does not support it. – Dennis – 2016-06-10T21:41:37.913
13"Your program/function may use only its own source as a reference point to its vote count" Is a bit confusing. Does this mean that answers should try to identify themselves only using knowledge of their own code, and not through something like a post id? I don't think that such a rule would be good, as it can be broken by anyone else posting a new answer. – FryAmTheEggman – 2016-06-10T22:21:42.620
@FryAmTheEggman I did put a bit of thought into breaking other peoples answers, and I even considered making this a KOTH where your source tries to undermine another answer, although in the end that seemed to be pushing the format more than I wanted... I added the
using its own source
bit to prevent users from setting up the page to make it easier to find itself without contributing to its byte count, in the case that the answer doesn't use the post id method. – Dendrobium – 2016-06-10T22:33:05.6402Alright, the wording is a bit weird. I would recommend instead of allowing certain behaviour in this way, instead directly ban using any web services besides those supplied by stackexchange (unless I've misunderstood you). As a side note, due to the nature of the completeness problem, it is not possible to make something like this unbreakable. The best you can do is make it implausible to be broken. – FryAmTheEggman – 2016-06-10T22:39:46.990
I don't get it. The question states to only use the page contents at
codegolf.stackexchange.com/questions/82609
as a reference. Yet everyone appears to be using the api atapi.stackexchange.com
. What am I missing? – Num Lock – 2016-06-13T09:41:07.453Are you going to accept an answer? (I want the badge about 2x outvoting the accepted answer, which is Dennis's convex one) – NoOneIsHere – 2016-08-05T20:20:14.293
@Dendrobium: I had developed an noncompeting answer that was a cousin to your KOTH idea, and I can't recommend going that route. Mine flopped miserably and was mod deleted for this and other reasons (as it should have been). Rather than undermining an answer, it went the other way and was self-deprecating while it complimented whichever author and answer was currently in the lead. This still had potential to influence votes and cause confusion if anyone had taken it seriously. – GuitarPicker – 2016-08-18T04:10:14.750
Please accept an answer. It has been quite a while. – NoOneIsHere – 2016-11-18T16:55:01.423