Beispiel #1
0
        public void TheBoardCanBeLoadedFromATextFile()
        {
            var filename = "SimpleTestBoard.txt";

            var gameBoard = GameSettingsLoader.LoadFromFile(filename);

            gameBoard.Should().BeEquivalentTo(new
            {
                Walls   = new CellLocation[] { (0, 0), (1, 0), (2, 0), (0, 1), (2, 1), (0, 2), (1, 2) },
Beispiel #2
0
        static async Task Main(string[] args)
        {
            var game = new Game.Game(new GameClock(), GameSettingsLoader.LoadFromFile("board.txt"));

            _allCoins = game.Coins;
            while (true)
            {
                var keys = GetAllKeysPressed();

                if (keys.Contains(ConsoleKey.Escape))
                {
                    break;
                }

                var directions = keys.Select(x => x switch
                {
                    ConsoleKey.UpArrow => Direction.Up,
                    ConsoleKey.DownArrow => Direction.Down,
                    ConsoleKey.LeftArrow => Direction.Left,
                    ConsoleKey.RightArrow => Direction.Right,
                    _ => (Direction?)null
                }).Where(x => x != null).ToList();