Exemplo n.º 1
0
        static void Main(string[] args)
        {
            System.ConsoleKeyInfo c;
            Board board = new Board();

            while (!board.finished)
            {
                board.Update_board();
                board.print();
                Console.WriteLine("enter an arrow key or wasd");
                c = Console.ReadKey();
                Console.WriteLine();
                if (c.Key == ConsoleKey.UpArrow || c.Key == ConsoleKey.W)
                {
                    Console.WriteLine("up!");
                    board.Act('u');
                }
                else if (c.Key == ConsoleKey.LeftArrow || c.Key == ConsoleKey.A)
                {
                    Console.WriteLine("left!");
                    board.Act('l');
                }
                else if (c.Key == ConsoleKey.DownArrow || c.Key == ConsoleKey.S)
                {
                    Console.WriteLine("down!");
                    board.Act('d');
                }
                else if (c.Key == ConsoleKey.RightArrow || c.Key == ConsoleKey.D)
                {
                    Console.WriteLine("right!");
                    board.Act('r');
                }
                else if (c.Key == ConsoleKey.Q || c.Key == ConsoleKey.Escape)
                {
                    board.init();
                }
                else
                {
                    Console.WriteLine("invalid key -> nothing happended!");
                }
            }
            //Console.WriteLine("Hello World!");
            Console.ReadLine();
        }