Example #1
0
        public void InitEngineTest()
        {
            Player player = new Player('*', 3, 3);
            IRenderer renderer = new ConsoleRenderer();
            IController controller = new KeyboardController();
            ScoreBoard scoreBoard = new ScoreBoard();

            Engine engine = new Engine(player, renderer, controller, scoreBoard);
        }
Example #2
0
        static void Main()
        {
            Console.WriteLine("Welcome to “Labirinth” game. Please try to escape. Use 'top' to view the top");
            Console.WriteLine("scoreboard, 'restart' to start a new game and 'exit' to quit the game.");

            ScoreBoard scoreBoard = new ScoreBoard();
            while (true)
            {
                IController keyboard = new KeyboardController();
                IRenderer renderer = new ConsoleRenderer();
                Player player = new Player('*', 3, 3);
                Engine engine = new Engine(player, renderer, keyboard, scoreBoard);

                engine.StartGame();
            }
        }
Example #3
0
        public void RenderTest()
        {
            Labyrinth lab = new Labyrinth(4);

            char[,] testMatrix = new char[,] {
                 {'-', 'X', '-', 'X'},
                 {'-', '-', '-', 'X'},
                 {'X', 'X', '-', '-'} ,
                 {'X', 'X', '-', '-'}
            };

            lab.TestMatrix(testMatrix);

            ConsoleRenderer renderer = new ConsoleRenderer();
            var actual = renderer.Render(lab);
            var expected = " - X - X\r\n - - - X\r\n X X - -\r\n X X - -\r\n";

            Assert.AreEqual(expected, actual);
        }