Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* Mathematica Script *)
- (* Nonuniform Grid *)
- baseURL = "http://oc.tc/stats";
- ind = Table[i^2, {i, 1, 75}];
- killsData = {};
- kills = 0;
- (* Get the kills on oc.tc/stats *)
- Do[
- url = baseURL <> "?page=" <> ToString[i];
- page = Import[url, "Data"];
- Do[kills = kills + page[[2, 1, 2, j, 4]];, {j,
- Length[page[[2, 1, 2]]]}];
- AppendTo[killsData, {i, kills}];
- kills = 0;,
- {i, ind}];
- (* Interpolate the kills data *)
- killsFunction = Interpolation[killsData];
- (* Integrate interpolation function to get total kills *)
- totalKills = N[NIntegrate[killsFunction[x], {x, 1, 13375}]];
- (* Display results *)
- Show[ListPlot[killsData, PlotRange -> {{0, 1000}, {0, 40000}},
- AxesLabel -> {"Page", "Kills"}],
- Plot[killsFunction[x], {x, 0, 1000}]]
- Print["Total Kills: ", totalKills];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement