mirror of
https://github.com/dancojocaru2000/ai-project-idastar.git
synced 2025-02-22 16:39:35 +02:00
Added border to input labyrinth
This commit is contained in:
parent
1f8dda0d66
commit
1a421e3285
1 changed files with 16 additions and 18 deletions
34
Program.cs
34
Program.cs
|
@ -5,23 +5,13 @@ string[] labyrinth = FormatLabyrinth(labyrinthIN);
|
|||
|
||||
Console.OutputEncoding = System.Text.Encoding.UTF8;
|
||||
|
||||
Console.WriteLine("The input labyrinth: ");
|
||||
foreach (string line in labyrinthIN)
|
||||
{
|
||||
FormattedLabRow(line);
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
Console.WriteLine("The formatted labyrinth: ");
|
||||
foreach (string line in labyrinth)
|
||||
{
|
||||
FormattedLabRow(line);
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
var algoBoard = new IdaStar.WorkingBoard(labyrinth.Select((row) => row.ToList()).ToList());
|
||||
int step = 0;
|
||||
ConsoleColor border = ConsoleColor.Magenta;
|
||||
|
||||
Console.WriteLine("The input labyrinth: ");
|
||||
PrintBoard(0, true, false);
|
||||
|
||||
bool printSteps = false;
|
||||
|
||||
Console.WriteLine();
|
||||
|
@ -37,7 +27,10 @@ if(printSteps) {
|
|||
}
|
||||
|
||||
algoBoard.RunIdaStar();
|
||||
PrintBoard(0, true, clearScreen: printSteps);
|
||||
if(printSteps) Console.Clear();
|
||||
Console.WriteLine("The solved labyrinth is:");
|
||||
PrintBoard(0, true, clearScreen: false);
|
||||
|
||||
|
||||
if (args.Contains("-w") || args.Contains("--wait")) {
|
||||
Console.ReadKey();
|
||||
|
@ -53,8 +46,7 @@ static void FormattedLabRow(string line) {
|
|||
break;
|
||||
}
|
||||
|
||||
case '.':
|
||||
case ' ': {
|
||||
case '.': {
|
||||
Console.BackgroundColor = ConsoleColor.Black;
|
||||
Console.Write(" ");
|
||||
break;
|
||||
|
@ -78,6 +70,12 @@ static void FormattedLabRow(string line) {
|
|||
break;
|
||||
}
|
||||
|
||||
case 'G': {
|
||||
Console.BackgroundColor = ConsoleColor.Green;
|
||||
Console.Write(" • ");
|
||||
break;
|
||||
}
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +115,7 @@ void PrintBoard(int threshold, bool done, bool clearScreen = true){
|
|||
if (clearScreen) Console.Clear();
|
||||
step++;
|
||||
if(done){
|
||||
Console.WriteLine("The solved labyrinth is:");
|
||||
|
||||
}else if(step%2 == 0) {
|
||||
Console.WriteLine($"Computing (threshold: {threshold}) [• ]");
|
||||
}else {
|
||||
|
|
Loading…
Add table
Reference in a new issue