16
2
In this challenge, you will calculate what your reputation would be, if the reputation cap didn't exist on PPCG.
Everyone can access the rawdata for reputation changes on the adress: codegolf.stackexchange.com/reputation. The raw data follows a setup like this (these are the first few lines of my version of the page.
total votes: 2955
-- bonuses (100)
2 37663 (10)
-- 2014-09-11 rep +110 = 111
2 41751 (10)
-- 2014-11-23 rep +10 = 121
2 41751 (10)
2 41751 (10)
-- 2014-11-24 rep +20 = 141
The first line is irrelevant for this challenge (it shows the total number of votes you have received on all your answers and questions). The second line shows the "Association bonus". If you don't have the bonus then that line will not be there at all.
After these two (or one, if no bonus) lines, you'll have a list of reputation changes per question, along with a summary of all the rep gained/lost on each day. You'll also get a list of the total reputation you have at the end of that day. Only days where your reputation changed are shown in this list.
There are identifiers in the beginning of each line (except the daily summary lines). These represent the following potential reputation change reasons:
1 : Accept (+2 if you accept, +15 if your answer is accepted)
2 : Upvote (+5 for question, +10 for answer)
3 : Downvote (-1 if you downvote answer, -2 if you get downvoted)
4 : Offensive (-100)
8 : Give bounty
9 : Receive bounty
12: Spam (-100)
16: Approved edit (+2)
The missing numbers (5,6,7,10,11,13,14,15
don't affect reputation).
Your challenge is to calculate the reputation you would have, if it weren't for the reputation cap.
How you'll do this:
Save the content of codegolf.stackexchange.com/reputation
as plain text locally, or some other place of your choosing (this is because you need to be logged in to access the information).
You may retrieve the data from the website directly if you prefer, although I assume that will be a lot longer.
Sum up all the positive and negative reputation changes. Votes that doesn't result in a reputation change (due to the rep cap) are shown like this (notice the square brackets, instead of regular parentheses):
2 106125 [0]
2 106125 [0]
3 106125 [-2]
2 106088 [2]
2 106125 [0]
2 106088 [0]
You must include the rep you would have received if it wasn't for the cap.
Post number 106125
is a question, while 106088
is an answer.
As you can see, there's no way to tell the difference between the two using only the data given in the table. You must therefore access the website (codegolf.stackexchange.com
) to check whether a post is a question or answer. You may also use the API for this.
Rules:
- Everyone must be able to run your script so:
- You must include all the different reputation change types, even if you haven't encountered it yourself.
- The code must work even if you haven't received the Association bonus (the line won't be there if you haven't)
- You may use non-free languages (Mathematica, MATLAB etc.), as long as others with a license can run the code.
- You do not have to provide the raw-data, since everyone can test your code on their own version of the page (it will be interesting if you share the results though, but that's optional).
- You may use the API or access the website directly. url-shorteners are not allowed.
- If there are other ways to find the rep you would have without the rep cap then you can't use it. You have to use the data from the mentioned page.
Note that posts that are answers get a different extension to the url:
https://codegolf.stackexchange.com/questions/106088 // Answer: Notice the end of the url
https://codegolf.stackexchange.com/questions/106079/detect-ms-windows/106088#106088
https://codegolf.stackexchange.com/questions/106079/ // Question: Notice the end of the url
https://codegolf.stackexchange.com/questions/106079/detect-ms-windows
Output:
The output should be:
Rep w cap: 15440
Rep w/o cap: 16202
The format is optional, [15440,16202]
is accepted. Rep w cap
can be taken directly from the line: ** total rep 15440 :)
near the bottom of the page.
This is code-golf so the shortest code in byte wins.
Related. – betseg – 2017-04-30T19:02:29.207
4 start="751">
2lol I've never hit the repcap before. – HyperNeutrino – 2017-05-01T06:10:30.673
Just to clarify, your reputation with cap is the sum your total rep, and the reputation changes inside the square brackets? – Graviton – 2017-05-05T03:23:04.323