本文整理汇总了C#中Storage.Print方法的典型用法代码示例。如果您正苦于以下问题:C# Storage.Print方法的具体用法?C# Storage.Print怎么用?C# Storage.Print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage.Print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
string TestType = "RotateCW";
if (args.Length > 0) {
TestType = args[0];
}
int TestTypeNum = 0;
switch (TestType) {
case "RandomSimple":
TestTypeNum = 0;
break;
case "RandomNoDouble":
TestTypeNum = 1;
break;
case "RotateCCW":
TestTypeNum = 2;
break;
case "RotateCW":
TestTypeNum = 3;
break;
case "RotateBoth":
TestTypeNum = 4;
break;
case "RotateBothRandom":
TestTypeNum = 5;
break;
}
int progressCheck = 100000;
if (args.Length > 1) {
int NumberOfCores = 1;
int.TryParse(args[1], out NumberOfCores);
Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(((int)Math.Pow(2, NumberOfCores)) - 1);
}
if (args.Length > 2) {
int.TryParse(args[2], out progressCheck);
}
Console.WriteLine("Using progress check of {0}", progressCheck);
string scoresFile = TestType + "scores.json";
Storage storage;
try {
string scores = System.IO.File.ReadAllText(scoresFile);
storage = JsonConvert.DeserializeObject<Storage>(scores);
storage.ScoresFile = scoresFile;
} catch {
storage = new Storage(scoresFile, TestType);
}
storage.ProgressCheck = progressCheck;
DateTime start = DateTime.Now;
Console.Title = "2048: " + TestType;
while (true) {
Parallel.For(0, 10000, i => {
RunGameIteration(TestTypeNum, storage);
});
}
try {
System.IO.File.WriteAllText(scoresFile, JsonConvert.SerializeObject(storage));
} catch (Exception e) {
Console.Error.WriteLine(e.ToString());
}
storage.Print();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
Console.Error.WriteLine("Done in {0} seconds!", DateTime.Now.Subtract(start).TotalSeconds);
Console.WriteLine();
Console.WriteLine();
Console.ReadLine();
}