Пример #1
0
        private static World LoadWorld(List <string> mazeLines)
        {
            var world  = new World();
            var loader = new WorldLoader();

            for (char ch = 'A'; ch <= 'Z'; ch++)
            {
                var teleportSymbol = ch;
                loader.AddRule(ch, location => new Teleport(location, teleportSymbol));
            }
            loader
            .AddRule('#', loc => new Wall(loc))
            .AddRule('!', loc => new Gelu(loc))
            .AddRule('$', loc => new Catherine(loc))
            .AddRule('*', loc => new Sandro(loc))
            .AddBorder('#');
            loader.Load(mazeLines, world);
            return(world);
        }