Advertisement
bcbwilla

Project Ares Kill Counter

Feb 17th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. (* Mathematica Script *)
  2. (* Nonuniform Grid *)
  3. baseURL = "http://oc.tc/stats";
  4. ind = Table[i^2, {i, 1, 75}];
  5. killsData = {};
  6. kills = 0;
  7. (* Get the kills on oc.tc/stats *)
  8. Do[
  9. url = baseURL <> "?page=" <> ToString[i];
  10. page = Import[url, "Data"];
  11. Do[kills = kills + page[[2, 1, 2, j, 4]];, {j,
  12. Length[page[[2, 1, 2]]]}];
  13. AppendTo[killsData, {i, kills}];
  14. kills = 0;,
  15. {i, ind}];
  16.  
  17. (* Interpolate the kills data *)
  18. killsFunction = Interpolation[killsData];
  19. (* Integrate interpolation function to get total kills *)
  20. totalKills = N[NIntegrate[killsFunction[x], {x, 1, 13375}]];
  21. (* Display results *)
  22. Show[ListPlot[killsData, PlotRange -> {{0, 1000}, {0, 40000}},
  23. AxesLabel -> {"Page", "Kills"}],
  24. Plot[killsFunction[x], {x, 0, 1000}]]
  25. Print["Total Kills: ", totalKills];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement