Advertisement
Tomhass

Untitled

Nov 7th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3.  
  4. namespace ArtificialIntelligenceCW
  5. {
  6.     class Program
  7.     {
  8.  
  9.  
  10.         static void Main(string[] args)
  11.         {
  12.             char[] seperator = { ',' };
  13.             string[] cavArray;
  14.             int size;
  15.             int coordsLength;
  16.  
  17.             ArrayList coordsList = new ArrayList();
  18.  
  19.  
  20.             // Reading the Cavern Files into a String
  21.             string cav = System.IO.File.ReadAllText(@"C:\Caverns\input1.cav");
  22.  
  23.             // Splitting cav file into array
  24.             cavArray = cav.Split(seperator, StringSplitOptions.RemoveEmptyEntries);
  25.             ArrayList cavList = new ArrayList(cavArray);
  26.  
  27.  
  28.             // Finding the amount of caves in the file
  29.             size = Convert.ToInt32(cavList[0]);
  30.             // Removing the first entry of the cavlist
  31.             cavList.RemoveAt(0);
  32.             // Finding the coords in the cav file
  33.             coordsLength = size * 2;
  34.  
  35.             // Getting the Array of Coords
  36.             for (int i = 0; i <= coordsLength; i++)
  37.             {
  38.                 coordsList.Add(cavList[i]);
  39.                 cavList.Remove(i);
  40.             }
  41.  
  42.         }
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement