# What would your reputation be without the rep cap?

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
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 so the shortest code in byte wins.

• Related. – betseg Apr 30 '17 at 19:02
• 751. Rip me and my life – Christopher Apr 30 '17 at 22:05
• lol I've never hit the repcap before. – HyperNeutrino May 1 '17 at 6:10
• Just to clarify, your reputation with cap is the sum your total rep, and the reputation changes inside the square brackets? – Graviton May 5 '17 at 3:23

# Perl 5 (with curl), 209+1(-n flag)=210 bytes

if(/([0-9]+)\s*([0-9]+) \[([0-9]*)/){$_=curl https://codegolf.stackexchange.com/a/$2;@p=(2,5,-1);$p[15]=2;@s=(13,5,-1);$x=$1;$r+=($p[--$x]//-100)-$3;$r+=$s[$x]if/#/;};$t=$1 if/([0-9]+) :/;END{say$t,$",$r+$t}


Abuses the fact that the url for an answer has a # in it. Can add a -s flag after curl if you don't like stderr being flooded with progress bars. I would appreciate someone with a more varied reputation page testing it- I can't be sure I didn't miss anything.

Mine is 421 and would be 451, by the way.

• I've never ever used Perl before, and I can't see where you get the rawdata from. Where do I put the rawdata if I want to test this? Note: I'm using Strawberry on Windows 10. I don't have Unix or OS X. And how would I call this? – Stewie Griffin May 7 '17 at 14:19
• @Stewie Griffin It reads the raw data from stdin. The code is a one-liner, and should be executed something like perl -nE 'code' < filename. You may have to do some different quoting and escaping of things on Windows, I'm not very familiar with the environment there. – Chris May 7 '17 at 17:41
• Small optimisation: you can remove the https:// if you pass the -L flag to curl, allowing it to follow the 301 redirect – markasoftware May 7 '17 at 19:20
• @Markasoftware That will follow the multiple redirects to the actual page, though, right? As it is, my code parses the 301 redirect from https://codegolf.stackexchange.com/a/\$2 rather than the page itself. – Chris May 7 '17 at 19:23
• I get Search pattern not terminated at -e line 1. when I try this. I simply paste the entire code using what you wrote in the comment (perl -nE ..), while having the file saved in the current working directory. Any idea why that might be? – Stewie Griffin May 7 '17 at 22:27