Example #1
0
        public void LoadOriginalMaps()
        {
            if (decompressor == null)
            {
                decompressor = new Decompressor();
            }
            originalMaps = new List <AMap> {
            };
            List <string[]> uncompressedMaps;

            loader = new Loader();

            loader.LoadMultiple(originalMapsLocation);
            uncompressedMaps = loader.ParseMap2();

            foreach (string[] map in uncompressedMaps)
            {
                AMap newEntry = new AMap();

                newEntry.Name = map[0];
                newEntry.Map  = decompressor.GetTheMap(map[1]);

                originalMaps.Add(newEntry);
            }

            /*foreach (AMap map in originalMaps)
             * {
             *  Console.WriteLine("name: {0}\n", map.Name);
             *  foreach (string str in map.Map)
             *  {
             *      Console.WriteLine(str);
             *  }
             * }*/
        }
Example #2
0
        public AMap LoadUserMap(string path)
        {
            if (decompressor == null)
            {
                decompressor = new Decompressor();
            }
            AMap   newMap = new AMap();
            string compressed;

            newMap.Name = Path.GetFileNameWithoutExtension(path);
            compressed  = File.ReadAllText(path);
            //Console.WriteLine("{0}, {1}", newMap.Name, compressed);
            newMap.Map = decompressor.GetTheMap(compressed);
            return(newMap);
        }
Example #3
0
        public bool TestCompressedLevel2(string theFile)
        {
            string newFile = LoadTextFile(theFile);

            string[] strArray = loader.ParseSingleMap(newFile);
            foreach (string s in strArray)
            {
                Console.WriteLine(s + ".");
            }
            string[] mapArray;
            if (decompressor == null)
            {
                decompressor = new Decompressor();
            }

            try
            {
                decompressor.GetTheMap(strArray[1]);
            }
            catch (Exception)
            {
                Console.WriteLine("1");
                return(false);
            }
            AMap newMap = new AMap();

            newMap.Name = strArray[0];
            newMap.Map  = decompressor.GetTheMap(strArray[1]);

            if (bridger == null)
            {
                bridger = new Bridger();
            }
            try
            {
                bridger.Convert(newMap);
                //bridger.Init(newMap);
            }
            catch (Exception)
            {
                Console.WriteLine("2");
                return(false);
            }
            return(true);
        }
Example #4
0
        static void Main(string[] args)
        {
            /*Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form_Splash());*/
            //new Controller(new ConsoleView(), new Game(), new FileHandler(), new LevelBuilder()).Init();

            FileHandler filer = new FileHandler();
            LevelBuilder builder = new LevelBuilder();
            /*Game theGame = new Game();
            filer.Init();
            filer.SetMap(0, "Map 1.");

            theGame.SetFiler(filer);
            theGame.SetMap();

            foreach (Tile tile in theGame.GetMap())
            {
                Console.WriteLine(tile.Coordinate);
            }

            Tile theTile = theGame.GetMap()[3, 2];
            Console.WriteLine(theTile.Coordinate);
            Console.WriteLine(theGame.GetMap().GetLength(0));
            Console.WriteLine(theTile.IsOuter(Direction.Left));

            int i = 105;

            Console.WriteLine(i / 50);*/
            /*
            Point p = new Point(4, 4);
            builder.Init(p);
            p = new Point(3, 0);
            builder.SelectTile(p);
            builder.Exit();
            builder.EastWall();

            p = new Point(0, 3);
            builder.SelectTile(p);
            builder.SetTheseus();
            p = new Point(0, 2);
            builder.SelectTile(p);
            builder.SetMinotaur();

            Console.WriteLine(builder.Test());

            builder.Clear();

            Console.WriteLine(builder.Test());

            /*filer.Init();
            filer.SetMap(0, "Map 6");
            filer.GetNextMap();*/

            //Console.WriteLine(MapCreator.ObjectsToString(filer.GetMap().Tiles, filer.GetMap().TheTheseus, filer.GetMap().TheMinotaur));
            Loader loader = new Loader();
            Compressor compressor = new Compressor();
            Decompressor decompressor;

            /*string str = filer.LoadTextFile(@"H:\2015\semester 2\PR 283 C#\Theseus\level1.txt");
            Console.WriteLine(str);

            string[] stra = loader.ToStringArray(str);
            compressor.LoadMap(stra);
            compressor.FindSpecialCharacters();
            compressor.CompressLevel1();
            compressor.SetTheResult();
            Console.WriteLine(compressor.GetLvl1());
            Saver saver = new Saver();
            saver.SetFileName("lvl1c1");
            saver.SaveSingle(@"H:\2015\semester 2\PR 283 C#\Theseus", compressor.GetLvl1());*/

            string newFile = filer.LoadTextFile(@"H:\2015\semester 2\PR 283 C#\Theseus\lvl1c1.txt");
            decompressor = new Decompressor();

            decompressor.SetCompressed(newFile);

            //try
            //{
                decompressor.SeparateToArrays();
            //}

                decompressor.DecompressLevel1();
                decompressor.SetCharacters();

            /*int x = 0;
            foreach (string st in stra)
            {
                Console.WriteLine(x.ToString() + st);
                Console.WriteLine(st.Length);
                x++;
            }

            Bridger bridger = new Bridger();

            AMap newMap = new AMap();
            newMap.Map = stra;

            newMap = bridger.Convert(newMap);

            Console.WriteLine(newMap.TheMinotaur.Coordinate);
            Console.WriteLine(newMap.TheTheseus.Coordinate);*/

            //filer.IsValid(@"H:\2015\semester 2\PR 283 C#\Theseus\level1.txt");

            Console.ReadKey();
        }
Example #5
0
        public bool TestCompressedLevel2(string theFile)
        {
            string newFile = LoadTextFile(theFile);
            string[] strArray;
            if (decompressor == null)
            {
                decompressor = new Decompressor();
            }

            try
            {
                strArray = decompressor.GetTheMap(newFile);
            }
            catch (Exception)
            {
                return false;
            }
            AMap newMap = new AMap();

            if (bridger == null)
            {
                bridger = new Bridger();
            }

            bridger.Init(newMap);

            if (!bridger.IsValid())
            {
                return false;
            }

            try
            {
                bridger.Convert(newMap);
            }
            catch (IndexOutOfRangeException)
            {
                return false;
            }
            return true;
        }
Example #6
0
        public bool TestCompressedL1(string theFile)
        {
            string newFile = LoadTextFile(theFile);
            string[] strArray;
            if (decompressor == null)
            {
                decompressor = new Decompressor();
            }
            decompressor.SetCompressed(newFile);

            try
            {
                decompressor.SeparateToArrays();
            }
            catch (IndexOutOfRangeException)
            {
                return false;
            }
            try
            {
                decompressor.DecompressLevel1();
            }
            catch (Exception)
            {
                return false;
            }
            try
            {
                decompressor.SetCharacters();
            }
            catch (Exception)
            {
                return false;
            }
            strArray = decompressor.GetLevel1Result();

            AMap newMap = new AMap();

            if (bridger == null)
            {
                bridger = new Bridger();
            }
            bridger.Init(newMap);

            if (!bridger.IsValid())
            {
                return false;
            }

            try
            {
                bridger.Convert(newMap);
            }
            catch (IndexOutOfRangeException)
            {
                return false;
            }
            return true;
        }
Example #7
0
 public AMap LoadUserMap(string path)
 {
     if (decompressor == null)
     {
         decompressor = new Decompressor();
     }
     AMap newMap = new AMap();
     string compressed;
     newMap.Name = Path.GetFileNameWithoutExtension(path);
     compressed = File.ReadAllText(path);
     //Console.WriteLine("{0}, {1}", newMap.Name, compressed);
     newMap.Map = decompressor.GetTheMap(compressed);
     return newMap;
 }
Example #8
0
        public void LoadOriginalMaps()
        {
            if (decompressor == null)
            {
                decompressor = new Decompressor();
            }
            originalMaps = new List<AMap> { };
            List<string[]> uncompressedMaps;
            loader = new Loader();

            loader.LoadMultiple(originalMapsLocation);
            uncompressedMaps = loader.ParseMap2();

            foreach (string[] map in uncompressedMaps)
            {
                AMap newEntry = new AMap();

                newEntry.Name = map[0];
                newEntry.Map = decompressor.GetTheMap(map[1]);

                originalMaps.Add(newEntry);
            }

            /*foreach (AMap map in originalMaps)
            {
                Console.WriteLine("name: {0}\n", map.Name);
                foreach (string str in map.Map)
                {
                    Console.WriteLine(str);
                }
            }*/
        }
Example #9
0
        public bool TestCompressedLevel2(string theFile)
        {
            string newFile = LoadTextFile(theFile);
            string[] strArray = loader.ParseSingleMap(newFile);
            foreach (string s in strArray)
            {
                Console.WriteLine(s + ".");
            }
            string[] mapArray;
            if (decompressor == null)
            {
                decompressor = new Decompressor();
            }

            try
            {
                decompressor.GetTheMap(strArray[1]);
            }
            catch (Exception)
            {
                Console.WriteLine("1");
                return false;
            }
            AMap newMap = new AMap();

            newMap.Name = strArray[0];
            newMap.Map = decompressor.GetTheMap(strArray[1]);

            if (bridger == null)
            {
                bridger = new Bridger();
            }
            try
            {
                bridger.Convert(newMap);
                //bridger.Init(newMap);
            }
            catch (Exception)
            {
                Console.WriteLine("2");
                return false;
            }
            return true;
        }
Example #10
0
        public bool TestCompressedL1(string theFile)
        {
            string newFile = LoadTextFile(theFile);
            string[] strArray;
            if (decompressor == null)
            {
                decompressor = new Decompressor();
            }
            decompressor.SetCompressed(newFile);

            try
            {
                decompressor.SeparateToArrays();
            }
            catch (Exception)
            {
                Console.WriteLine("1");
                return false;
            }
            try
            {
                decompressor.DecompressLevel1();
            }
            catch (Exception)
            {
                Console.WriteLine("2");
                return false;
            }
            try
            {
                decompressor.SetCharacters();
            }
            catch (Exception)
            {
                Console.WriteLine("3");
                return false;
            }
            strArray = decompressor.GetLevel1Result();

            AMap newMap = new AMap();

            newMap.Map = strArray;

            if (bridger == null)
            {
                bridger = new Bridger();
            }

            try
            {
                bridger.Convert(newMap);
                //bridger.Init(newMap);

            }
            catch (Exception)
            {
                Console.WriteLine("4");
                return false;
            }
            return true;
        }
Example #11
0
        public bool TestCompressedL1(string theFile)
        {
            string newFile = LoadTextFile(theFile);

            string[] strArray;
            if (decompressor == null)
            {
                decompressor = new Decompressor();
            }
            decompressor.SetCompressed(newFile);


            try
            {
                decompressor.SeparateToArrays();
            }
            catch (Exception)
            {
                Console.WriteLine("1");
                return(false);
            }
            try
            {
                decompressor.DecompressLevel1();
            }
            catch (Exception)
            {
                Console.WriteLine("2");
                return(false);
            }
            try
            {
                decompressor.SetCharacters();
            }
            catch (Exception)
            {
                Console.WriteLine("3");
                return(false);
            }
            strArray = decompressor.GetLevel1Result();

            AMap newMap = new AMap();

            newMap.Map = strArray;

            if (bridger == null)
            {
                bridger = new Bridger();
            }



            try
            {
                bridger.Convert(newMap);
                //bridger.Init(newMap);
            }
            catch (Exception)
            {
                Console.WriteLine("4");
                return(false);
            }
            return(true);
        }