Advertisement
Tomhass

Untitled

Nov 7th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.31 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3.  
  4. namespace ArtiIntelCW
  5. {
  6.  
  7.  
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             char[] seperator = { ',' };
  13.             string[] cavArray;
  14.             // The amount of caves in the file
  15.             int size;
  16.             int coordsLength;
  17.             int connectivitySize;
  18.  
  19.             // List of Coordinates
  20.             ArrayList coordsList = new ArrayList();
  21.  
  22.  
  23.  
  24.             // Reading the Cavern Files into a String
  25.             string cav = System.IO.File.ReadAllText(@"H:\Caverns\generated100-1.cav");
  26.             if (cav != null)
  27.             {
  28.                 Console.WriteLine("File Loaded.");
  29.             }
  30.             else
  31.             {
  32.                 Console.WriteLine("File Failed to Load");
  33.             }
  34.  
  35.             // Splitting cav file into array
  36.             cavArray = cav.Split(seperator, StringSplitOptions.RemoveEmptyEntries);
  37.  
  38.             // List of remaining data in the file
  39.             ArrayList cavList = new ArrayList(cavArray);
  40.  
  41.  
  42.             // Finding the amount of caves in the file
  43.             size = Convert.ToInt32(cavList[0]);
  44.             // Removing the first entry of the cavlist
  45.             cavList.RemoveAt(0);
  46.             // Finding the coords in the cav file
  47.             coordsLength = size * 2 - 1;
  48.             connectivitySize = size * size;
  49.  
  50.  
  51.             // Getting the Array of Coords and removing unecessary text from cavList
  52.             for (int i = 0; i <= coordsLength; i++)
  53.             {
  54.                 coordsList.Add(cavList[i]);
  55.                 Console.WriteLine("Added: " + cavList[i] + " to list of coords");
  56.                 Console.WriteLine("Removed: " + cavList[i] + ". from cav list.");
  57.                 cavList.RemoveAt(0);
  58.             }
  59.  
  60.             string value = string.Join(",", cavList.ToArray());
  61.  
  62.             Console.WriteLine(value);
  63.  
  64.  
  65.             for (int i = 0; i <= size; i++)
  66.             {
  67.                 for (int x = 0; x <= size; x++)
  68.                 {
  69.  
  70.                 }
  71.             }
  72.  
  73.  
  74.             Console.WriteLine("There are: " + size + " caves in this file.");
  75.             Console.WriteLine("Calculating fastest route.");
  76.             // Finding the end of the cav file.
  77.             int connectorSize = size * size;
  78.         }
  79.  
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement