Skip to content

Commit

Permalink
v.0.6.0
Browse files Browse the repository at this point in the history
Price calculation and better combinations display
  • Loading branch information
Prevter committed Apr 7, 2021
1 parent 402eac6 commit d32ae61
Show file tree
Hide file tree
Showing 17 changed files with 764 additions and 365 deletions.
Binary file modified .vs/FloatToolGUI/v16/.suo
Binary file not shown.
10 changes: 0 additions & 10 deletions FloatToolGUI/App.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="FloatToolGUI.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
Expand All @@ -16,11 +13,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<applicationSettings>
<FloatToolGUI.Properties.Settings>
<setting name="Nova" serializeAs="String">
<value />
</setting>
</FloatToolGUI.Properties.Settings>
</applicationSettings>
</configuration>
108 changes: 54 additions & 54 deletions FloatToolGUI/Benchmark.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 31 additions & 22 deletions FloatToolGUI/Benchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,60 +67,50 @@ public enum SearchMode
public static string setprecission(double number, int figures)
{
int e = 0;

while (number >= 10.0)
{
e += 1;
number /= 10;
}

while (number < 1.0)
{
e -= 1;
number *= 10;
}

figures--;

number = (float)Math.Round(number, figures);

figures += 0 - e;
while (e > 0)
{
number *= 10;
e -= 1;
}

while (e < 0)
{
number /= 10;
e += 1;
}

if (figures < 0)
{
figures = 0;
}

return number.ToString($"f{figures}");
return number.ToString($"f{figures}", CultureInfo.InvariantCulture);
}
static public decimal craft(double[] ingridients, float minFloat, float maxFloat)
static public decimal craft(List<InputSkin> ingridients, float minFloat, float maxFloat)
{
decimal avgFloat = 0;
foreach (double f in ingridients)
foreach (InputSkin f in ingridients)
{
avgFloat += (decimal)f;
avgFloat += (decimal)f.WearValue;
}
avgFloat /= 10;
return ((decimal)(maxFloat - minFloat) * avgFloat) + (decimal)minFloat;
}
static public string craftF(double[] ingridients, float minFloat, float maxFloat)
static public string craftF(List<InputSkin> ingridients, float minFloat, float maxFloat)
{
float avgFloat = 0;
float[] arrInput = new float[10];
for (int i = 0; i < 10; i++)
{
arrInput[i] = Convert.ToSingle(ingridients[i]);
arrInput[i] = Convert.ToSingle(ingridients[i].WearValue);
}
foreach (float f in arrInput)
{
Expand All @@ -130,14 +120,15 @@ static public string craftF(double[] ingridients, float minFloat, float maxFloat
return setprecission(((maxFloat - minFloat) * avgFloat) + minFloat, 10);
}

public void parseCraft(double[] inputs, List<Skin> outputs, string want)
public void parseCraft(List<InputSkin> inputs, List<Skin> outputs, string want)
{
//List<double> results = new List<double>();
decimal wantFloat;
decimal.TryParse(want, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out wantFloat);

foreach (var item in outputs)
{
decimal flotOrigin = Math.Round(craft(inputs.ToArray(), item.MinFloat, item.MaxFloat), 14);
decimal flotOrigin = Math.Round(craft(inputs, item.MinFloat, item.MaxFloat), 14);
string flot = craftF(inputs, item.MinFloat, item.MaxFloat);

if (
Expand All @@ -151,11 +142,11 @@ public void parseCraft(double[] inputs, List<Skin> outputs, string want)
}
}

public void secndThread(List<Skin> craftList, string wanted, double[] pool, int start, int skip)
public void secndThread(List<Skin> craftList, string wanted, List<InputSkin> pool, int start, int skip)
{
foreach (IEnumerable<double> pair in Combinations(pool, 10, start, skip))
foreach (IEnumerable<InputSkin> pair in Combinations(pool, 10, start, skip))
{
parseCraft(pair.ToArray(), craftList, wanted);
parseCraft(pair.ToList(), craftList, wanted);
currComb++;
}
}
Expand Down Expand Up @@ -191,14 +182,17 @@ private void StartCalculation()
0.157685652375221, 0.217334255576134
};

List<InputSkin> inputSkins = new List<InputSkin>();
foreach (double f in pool) inputSkins.Add(new InputSkin(f, 0.03f, Currency.USD));

Stopwatch timer = Stopwatch.StartNew();

var threads = Environment.ProcessorCount;
try
{
for (int i = 0; i < threads; i++)
{
Thread newThread = new Thread(() => secndThread(outcomes, "1", pool, i, threads));
Thread newThread = new Thread(() => secndThread(outcomes, "1", inputSkins, i, threads));
newThread.Start();
t2.Add(newThread);
}
Expand Down Expand Up @@ -348,5 +342,20 @@ private void DragWindowMouseDown(object sender, MouseEventArgs e)
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}
}

private void panel7_Paint(object sender, PaintEventArgs e)
{

}

private void panel9_Paint(object sender, PaintEventArgs e)
{

}

private void panel7_Paint_1(object sender, PaintEventArgs e)
{

}
}
}
Loading

0 comments on commit d32ae61

Please sign in to comment.