Ejemplo n.º 1
0
        static async Task Run(int frameWait)
        {
            var ThePlayer = new Player(new System.Drawing.Point(25, 25));

            TheBoard  = new Board((int)(Console.WindowHeight * .9), (int)(Console.WindowWidth * .9), ThePlayer);
            FrameWait = frameWait;
            do
            {
                while (!Console.KeyAvailable)
                {
                    await Delay();

                    try
                    {
                        await ProcessBoardState();
                    }
                    catch (EndOfGameException e)
                    {
                        await WriteResults(e);
                    }
                    await UpdateBoard();
                }
            } while (!GetUserInput());
            try
            {
                TheBoard.EndGame("Escape key pressed!");
            }
            catch (EndOfGameException e)
            {
                await WriteResults(e);
            }
        }