示例#1
0
 private void setup(IComputerAI ai)
 {
     _ai   = ai;
     _game = new Step4Game();
     _view = new Step4View(_game);
     _game.Reset();
     _view.Reset();
 }
示例#2
0
        private ConsoleKey onKeyPress()
        {
            ConsoleKey key = Console.ReadKey(true).Key;

            switch (key)
            {
            case ConsoleKey.UpArrow:
                _view.MoveCursor(0, -1);
                break;

            case ConsoleKey.DownArrow:
                _view.MoveCursor(0, 1);
                break;

            case ConsoleKey.LeftArrow:
                _view.MoveCursor(-1, 0);
                break;

            case ConsoleKey.RightArrow:
                _view.MoveCursor(1, 0);
                break;

            case ConsoleKey.Enter:
                takeTurns();
                break;

            case ConsoleKey.F3:
                _game.Reset();
                _view.Reset();
                break;

            default:
                break;
            }
            return(key);
        }