Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- static int roundUp(int numToRound, int multiple)
- {
- if (multiple == 0)
- return numToRound;
- int remainder = numToRound % multiple;
- if (remainder == 0)
- return numToRound;
- return numToRound + multiple - remainder;
- }
- static void Main(string[] args)
- {
- //Console.WriteLine("Please enter the constant:");
- //float con = float.Parse(Console.ReadLine());
- const int rankCount = 10000;
- const int roundVal = 50;
- double[] table = new double[rankCount + 1];
- double[] changeFP = new double[rankCount + 1];
- double[] diffOC = new double[rankCount + 1];
- for (int i = 1; i <= rankCount; i++)
- {
- table[i] = roundUp((int)(1000 * Math.Pow(i, 1.582)), roundVal);
- }
- // change from previous
- for (int i = 1; i <= rankCount; i++)
- {
- if (i == 0)
- {
- continue;
- }
- else
- {
- changeFP[i] = roundUp((int)(table[i] - table[i - 1]), roundVal);
- }
- }
- // difference of change
- for (int i = 1; i <= rankCount; i++)
- {
- if (i == 0)
- {
- continue;
- }
- else
- {
- diffOC[i] = roundUp((int)(changeFP[i] - changeFP[i - 1]), roundVal);
- }
- }
- System.IO.File.Delete("ranktable.html");
- System.IO.File.AppendAllText("ranktable.html", "<!DOCTYPE html>"+
- "<html>"+
- "<head>"+
- "<style>"+
- "table {"+
- "font-family: arial, sans-serif;"+
- "border-collapse: collapse;"+
- "width: 100%;"+
- "}"+
- ""+
- "td, th {"+
- "border: 1px solid #aaaaaa;"+
- "text-align: left;"+
- "padding: 8px;"+
- "}"+
- ""+
- "tr:nth-child(even) {"+
- "background-color: #dddddd;"+
- "}"+
- "</style>"+
- "</head>"+
- "<body>"+
- ""+
- "<table>"+
- "<tr>"+
- "<th>Level</th>"+
- "<th>XP Required</th>"+
- "<th>Change from previous</th>"+
- "<th>Difference of change</th>"+
- "</tr>");
- for (int i = 0; i <= rankCount; i++)
- {
- string format = " <tr>" +
- "<td>{0}</td>" +
- "<td>{1}</td>" +
- "<td>+{2}</td>" +
- "<td>{3}{4}</td>" +
- "</tr>";
- string output = String.Format(
- format, i + 1,
- String.Format("{0:n0}", table[i]),
- String.Format("{0:n0}", changeFP[i]),
- (diffOC[i] > 0) ? "+" : "",
- String.Format("{0:n0}", diffOC[i])
- );
- System.IO.File.AppendAllText("ranktable.html", output + "\n");
- }
- System.IO.File.AppendAllText("ranktable.html", "</table></ body ></ html > ");
- Console.WriteLine("DONE");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment