Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace mozesieuda
- {
- public static class FilesStream
- {
- public static char[,] map = null;
- public static Treenode mainnode = null;
- public static LinkedList<Treenode> list;
- public static int rows, columns;
- public static int counter=0;
- public static void GetInput()
- {
- rows = 0;
- columns = 0;
- map = null;
- int z = 0;
- try
- {
- using (StreamReader str = new StreamReader("in3.txt"))
- {
- string line = "";
- while ((line = str.ReadLine()) != null)
- {
- if (line.Length == columns)
- {
- for (int i = 0; i < columns; i++)
- {
- map[z, i] = line[i];
- if(line[i]=='x' && z!=0&& z!=rows-1 && i!=0 && i!=columns-1)
- {
- list.AddLast(new Treenode {currentrow=z,currentcolumn=i});
- }
- }
- z++;
- }
- else
- {
- var split = line.Split(' ');
- list = new LinkedList<Treenode>();
- int.TryParse(split[0], out rows);
- int.TryParse(split[1], out columns);
- map = new char[rows, columns];
- }
- }
- }
- }
- catch (IOException)
- {
- Console.WriteLine("File not found");
- throw;
- }
- }
- public static void Output(int? island, int? river)
- {
- using (StreamWriter stw = new StreamWriter("out3.txt"))
- {
- stw.Write(island + " " + river);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement