예제 #1
0
 static void Main(string[] args)
 {
     var jsonFile = File.ReadAllText("random-w100000-h5-c100000.json");
     GameInfo gameInfo = JsonConvert.DeserializeObject<GameInfo>(jsonFile);
     Game game = new Game(gameInfo.Width,gameInfo.Height,gameInfo.Pieces);
     Commands commands = new Commands(gameInfo.Commands);
     Stopwatch sw = new Stopwatch();
     sw.Start();
     while (!commands.IsFinished())
     {
         char command = commands.GetCurrentCommand();
         commands = commands.CommandExecuted();
         if (char.ToLower(command) != 'p')
         {
             game = game.MovePiece(ExecuteCommand(game,command));
             if (game.PieceFixed)
             {
                 Console.WriteLine((commands.CommandNum - 1) + " " + game.Score);
             }
         }
         else
         {
             Console.WriteLine(game.ToString());
         }
         /*if (commands.CommandNum > 425)
         {
             Console.WriteLine(commands.GetCurrentCommand());
             Console.WriteLine(game.ToString());
             Console.ReadKey();
         }*/
     }
     sw.Stop();
     Console.WriteLine(sw.ElapsedMilliseconds);
 }