-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMap.cs
More file actions
46 lines (44 loc) · 1.16 KB
/
Copy pathMap.cs
File metadata and controls
46 lines (44 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace OOPFirst
{
class Map
{
public int MapWidth = 50;
public int MapHight = 20;
public char[,] map;
public char[,] MapReader()
{
using (var readMap = new StreamReader(@"C:\Users\shipo\source\repos\OOPFirst\Map.txt"))
{
int i = 0;
map = new char[MapHight, MapWidth];
while (!readMap.EndOfStream)
{
string mapRow = readMap.ReadLine();
for (int j = 0; j < mapRow.Length; ++j)
{
map[i, j] = mapRow[j];
}
i++;
}
}
return map;
}
public void MapWriter(char[,] map)
{
for (int i = 0; i < MapHight; i++)
{
for (int j = 0; j < MapWidth; j++)
{
Console.Write(map[i, j]);
}
Console.WriteLine();
}
}
}
}