示例#1
0
        static void Main(string[] args)
        {
            var factory = new WorldFactory();
            var world   = factory.GetWorld();
            var printer = new WorldPrinter(false, 10);

            printer.Print(world);

            while (world.MakeStep(o => ObserveWorld(printer, world, o)))
            {
                ;
            }

            printer.Print(world);
            Console.WriteLine($"Wet tiles: {world.NumberOfWetTiles}");
        }
示例#2
0
        static void Main(string[] args)
        {
            var world        = GetInitialState();
            var worldPrinter = new WorldPrinter();

            for (int tick = 0; world.Carts.Count > 1; tick++)
            {
                world.MakeStep();
                worldPrinter.Print(world, world.Carts[0]);
                Console.ReadKey();
            }

            var lastCart = world.Carts[0];

            Console.WriteLine();
            Console.WriteLine($"Last cart at position ({lastCart.Position.X},{lastCart.Position.Y})");
            Console.ReadKey();
        }
示例#3
0
        static void Main(string[] args)
        {
            var factory = new WorldFactory();
            var world   = factory.GetInitialState();
            var printer = new WorldPrinter();

            int numOfFullRounds = -1;

            do
            {
                numOfFullRounds++;
                printer.Print(world);
                Console.WriteLine($"After round {numOfFullRounds}");
                //Console.ReadKey();
            }while (world.MakeRound());

            var sumOfHitpoints = world.Fighters.Sum(w => w.HP);

            Console.WriteLine();
            Console.WriteLine($"Done. Number of full rounds: {numOfFullRounds} Sum of hitpoints remainging: {sumOfHitpoints}");
            Console.Write($"Part 1: {numOfFullRounds * sumOfHitpoints}");
            Console.ReadKey();
        }