Advertisement
pol9na

Untitled

Mar 23rd, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7. namespace Study
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             char[,] map=ReadMap("map1");
  14.            
  15.         }
  16.         static void DrawMap(char[,] map) {
  17.         for (int i = 0; i < map.GetLength(0); i++)
  18.             {
  19.                 for (int j = 0; j < map.GetLength(1); j++)
  20.                 {
  21.                     Console.Write(map[i,j]);
  22.  
  23.                 }
  24.                 Console.WriteLine();
  25.  
  26.             }
  27.         }
  28.         static char[,] ReadMap(string mapName)
  29.         {
  30.             string[] newFile = File.ReadAllLines($"Maps/{mapName}.txt");
  31.             char[,] map=new char[newFile.Length,newFile[0].Length];
  32.  
  33.             for (int i = 0; i < map.GetLength(0); i++)
  34.             {
  35.  
  36.                 for (int j = 0; j < map.GetLength(1); j++)
  37.                 {
  38.                     map[i, j] = newFile[i][j];
  39.                 }
  40.              
  41.             }
  42.                 return map;
  43.            
  44.             }
  45.         }
  46.  
  47.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement