-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
24,982 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
12 changes: 12 additions & 0 deletions
12
AmountOrganization/AmountOrganization.WWI/AmountOrganization.WWI.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net5</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\AmountOrganization\AmountOrganization.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.Linq; | ||
using AmountOrganization; | ||
using AmountOrganization.WWI; | ||
|
||
Console.WriteLine("Hello World!"); | ||
|
||
var inputs = 50; | ||
var users = 40; | ||
|
||
var randomAmounts = Sample.Amounts.GetRandomElements(inputs); | ||
var groups = randomAmounts.RandomGroups(users).ToArray(); | ||
|
||
var outputCount = 0; | ||
IMixer mixer = new WwiMixer(); | ||
var mix = mixer.CompleteMix(groups); | ||
foreach (var userOutputs in mix) | ||
{ | ||
outputCount += userOutputs.Count(); | ||
Console.ForegroundColor = ConsoleColor.Green; | ||
Console.Write($"{userOutputs.Sum()}\t"); | ||
Console.ForegroundColor = ConsoleColor.White; | ||
Console.WriteLine($"{string.Join(", ", userOutputs.OrderByDescending(x => x))}"); | ||
Console.WriteLine(); | ||
} | ||
|
||
foreach (var (value, count) in mix | ||
.SelectMany(x => x).GroupBy(x => x) | ||
.ToDictionary(x => x.Key, y => y.Count()) | ||
.Select(x => (x.Key, x.Value)) | ||
.OrderBy(x => x.Key)) | ||
{ | ||
if (count == 1) | ||
{ | ||
Console.ForegroundColor = ConsoleColor.Red; | ||
} | ||
Console.WriteLine($"There are {count} occurrences of {value} BTC output."); | ||
Console.ForegroundColor = ConsoleColor.White; | ||
} | ||
|
||
Console.WriteLine(); | ||
Console.WriteLine($"Number of users:\t{users}"); | ||
Console.WriteLine($"Number of inputs:\t{inputs}"); | ||
Console.WriteLine($"Number of outputs:\t{outputCount}"); | ||
|
||
Console.ReadLine(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace AmountOrganization.WWI | ||
{ | ||
public class WwiMixer : IMixer | ||
{ | ||
public IEnumerable<ulong> Mix(IEnumerable<ulong> myInputs, IEnumerable<ulong> othersInputs) | ||
{ | ||
var remaining = myInputs.Sum(); | ||
for (int i = 0; i < 50; i++) | ||
{ | ||
var denom = (ulong)Math.Pow(2, i); | ||
if (denom > remaining) | ||
{ | ||
yield return remaining; | ||
break; | ||
} | ||
|
||
yield return denom; | ||
|
||
remaining -= denom; | ||
} | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
AmountOrganization/AmountOrganization.WWI/bin/Debug/net5/AmountOrganization.WWI.deps.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"runtimeTarget": { | ||
"name": ".NETCoreApp,Version=v5.0", | ||
"signature": "" | ||
}, | ||
"compilationOptions": {}, | ||
"targets": { | ||
".NETCoreApp,Version=v5.0": { | ||
"AmountOrganization.WWI/1.0.0": { | ||
"dependencies": { | ||
"AmountOrganization": "1.0.0" | ||
}, | ||
"runtime": { | ||
"AmountOrganization.WWI.dll": {} | ||
} | ||
}, | ||
"AmountOrganization/1.0.0": { | ||
"runtime": { | ||
"AmountOrganization.dll": {} | ||
} | ||
} | ||
} | ||
}, | ||
"libraries": { | ||
"AmountOrganization.WWI/1.0.0": { | ||
"type": "project", | ||
"serviceable": false, | ||
"sha512": "" | ||
}, | ||
"AmountOrganization/1.0.0": { | ||
"type": "project", | ||
"serviceable": false, | ||
"sha512": "" | ||
} | ||
} | ||
} |
Binary file added
BIN
+9.5 KB
AmountOrganization/AmountOrganization.WWI/bin/Debug/net5/AmountOrganization.WWI.dll
Binary file not shown.
Binary file added
BIN
+140 KB
AmountOrganization/AmountOrganization.WWI/bin/Debug/net5/AmountOrganization.WWI.exe
Binary file not shown.
Binary file added
BIN
+10.3 KB
AmountOrganization/AmountOrganization.WWI/bin/Debug/net5/AmountOrganization.WWI.pdb
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
...ation/AmountOrganization.WWI/bin/Debug/net5/AmountOrganization.WWI.runtimeconfig.dev.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"runtimeOptions": { | ||
"additionalProbingPaths": [ | ||
"C:\\Users\\user\\.dotnet\\store\\|arch|\\|tfm|", | ||
"C:\\Users\\user\\.nuget\\packages", | ||
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" | ||
] | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...anization/AmountOrganization.WWI/bin/Debug/net5/AmountOrganization.WWI.runtimeconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"runtimeOptions": { | ||
"tfm": "net5.0", | ||
"framework": { | ||
"name": "Microsoft.NETCore.App", | ||
"version": "5.0.0" | ||
} | ||
} | ||
} |
Binary file added
BIN
+19.5 KB
AmountOrganization/AmountOrganization.WWI/bin/Debug/net5/AmountOrganization.dll
Binary file not shown.
Binary file added
BIN
+12.4 KB
AmountOrganization/AmountOrganization.WWI/bin/Debug/net5/AmountOrganization.pdb
Binary file not shown.
Oops, something went wrong.