1
0
Fork 0
mirror of https://github.com/dancojocaru2000/ai-project-idastar.git synced 2025-02-23 00:49:34 +02:00
ai-project-idastar/Program.cs
2021-12-01 21:17:53 +02:00

59 lines
No EOL
1.5 KiB
C#

// See https://aka.ms/new-console-template for more information
string[] labyrinthIN = System.IO.File.ReadAllLines(@"C:\UNI\AI\IDAstar\labyrinth.txt");
string[] labyrinthOUT = System.IO.File.ReadAllLines(@"C:\UNI\AI\IDAstar\labyrinthOUT.txt");
System.Console.WriteLine("The input labyrinth: ");
foreach (string line in labyrinthIN)
{
FormattedLabRow(line);
}
System.Console.WriteLine("The output labyrinth: ");
foreach (string line in labyrinthOUT)
{
FormattedLabRow(line);
}
void FormattedLabRow(string line) {
char[] characters = line.ToCharArray();
foreach (char c in characters) {
switch ( c ) {
case '#': {
Console.BackgroundColor = ConsoleColor.White;
Console.Write(" ");
break;
}
case ' ': {
Console.BackgroundColor = ConsoleColor.Black;
Console.Write(" ");
break;
}
case 'S': {
Console.BackgroundColor = ConsoleColor.Green;
Console.Write(" ");
break;
}
case 'F': {
Console.BackgroundColor = ConsoleColor.Red;
Console.Write(" ");
break;
}
case 'p': {
Console.BackgroundColor = ConsoleColor.Cyan;
Console.Write(" ");
break;
}
default: break;
}
}
Console.ResetColor();
Console.WriteLine();
}