Example #1
0
        public static void part2()
        {
            Arcade arcade = new Arcade(true);

            while (true)
            {
                int  x  = (int)arcade.run();
                int  y  = (int)arcade.run();
                long id = arcade.run();
                if (y == -1 || id == -1)
                {
                    break;
                }
                if (x == -1 && y == 0)
                {
                    Console.CursorLeft = 40;
                    Console.CursorTop  = 25;
                    Console.Write(id + "                              ");
                    continue;
                }
                Console.CursorLeft = x;
                Console.CursorTop  = y;

                switch (id)
                {
                case 0:
                    Console.Write(' ');
                    break;

                case 1:
                    Console.Write('|');
                    break;

                case 2:
                    Console.Write('X');
                    break;

                case 3:
                    Console.Write('-');
                    break;

                case 4:
                    Console.Write('o');
                    break;
                }
            }

            Console.WriteLine();
            Console.Read();
        }
Example #2
0
        public static void part1()
        {
            Arcade arcade = new Arcade(false);

            int count = 0;

            while (true)
            {
                long x  = arcade.run();
                long y  = arcade.run();
                long id = arcade.run();
                if (id == 2)
                {
                    count++;
                }
                if (x == -1 || y == -1 || id == -1)
                {
                    break;
                }
            }

            Console.WriteLine(count);
            Console.Read();
        }