mirror of
https://github.com/dancojocaru2000/ai-project-idastar.git
synced 2025-02-23 00:49:34 +02:00
Working labyrinth display
This commit is contained in:
parent
f251002a37
commit
63e18009c7
1 changed files with 13 additions and 10 deletions
23
Program.cs
23
Program.cs
|
@ -1,6 +1,6 @@
|
||||||
using IdaStar;
|
using IdaStar;
|
||||||
|
|
||||||
string[] labyrinthIN = System.IO.File.ReadAllLines(@"C:\UNI\AI\IDAstar\labyrinthOUT.txt");
|
string[] labyrinthIN = System.IO.File.ReadAllLines(@"C:\UNI\AI\IDAstar\labyrinth.txt");
|
||||||
|
|
||||||
|
|
||||||
System.Console.WriteLine("The input labyrinth: ");
|
System.Console.WriteLine("The input labyrinth: ");
|
||||||
|
@ -19,17 +19,18 @@ algoBoard.AlgorithmStep += (_) => {
|
||||||
if(done){
|
if(done){
|
||||||
System.Console.WriteLine("The solved labyrinth is:");
|
System.Console.WriteLine("The solved labyrinth is:");
|
||||||
}else if(step/2 == 0) {
|
}else if(step/2 == 0) {
|
||||||
System.Console.WriteLine("Computing [• ]");
|
System.Console.WriteLine("Computing [· ]");
|
||||||
}else {
|
}else {
|
||||||
System.Console.WriteLine("Computing [ •]");
|
System.Console.WriteLine("Computing [ ·]");
|
||||||
}
|
}
|
||||||
|
|
||||||
//top border
|
//top border
|
||||||
Console.BackgroundColor = border;
|
Console.BackgroundColor = border;
|
||||||
for (var i=0; i<algoBoard.Board[0].Count()+2; i++){
|
for (var i=0; i<algoBoard.Board[0].Count()+2; i++){
|
||||||
Console.Write("===");
|
Console.Write(" ");
|
||||||
}
|
}
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
foreach (var line in algoBoard.Board)
|
foreach (var line in algoBoard.Board)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +39,7 @@ algoBoard.AlgorithmStep += (_) => {
|
||||||
|
|
||||||
//left border
|
//left border
|
||||||
Console.BackgroundColor = border;
|
Console.BackgroundColor = border;
|
||||||
Console.Write("|||");
|
Console.Write(" ");
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
|
|
||||||
//labyrinth line
|
//labyrinth line
|
||||||
|
@ -46,16 +47,19 @@ algoBoard.AlgorithmStep += (_) => {
|
||||||
|
|
||||||
//right border
|
//right border
|
||||||
Console.BackgroundColor = border;
|
Console.BackgroundColor = border;
|
||||||
Console.Write("|||");
|
Console.Write(" ");
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
|
|
||||||
|
Console.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
//bottom border
|
//bottom border
|
||||||
Console.BackgroundColor = border;
|
Console.BackgroundColor = border;
|
||||||
for (var i=0; i<algoBoard.Board[0].Count()+2; i++){
|
for (var i=0; i<algoBoard.Board[0].Count()+2; i++){
|
||||||
Console.Write("===");
|
Console.Write(" ");
|
||||||
}
|
}
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
|
Console.WriteLine();
|
||||||
};
|
};
|
||||||
|
|
||||||
algoBoard.RunIdaStar();
|
algoBoard.RunIdaStar();
|
||||||
|
@ -79,7 +83,7 @@ void FormattedLabRow(string line) {
|
||||||
|
|
||||||
case 'S': {
|
case 'S': {
|
||||||
Console.BackgroundColor = ConsoleColor.Green;
|
Console.BackgroundColor = ConsoleColor.Green;
|
||||||
Console.Write("<•>");
|
Console.Write("<·>");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +95,7 @@ void FormattedLabRow(string line) {
|
||||||
|
|
||||||
case 'p': {
|
case 'p': {
|
||||||
Console.BackgroundColor = ConsoleColor.Blue;
|
Console.BackgroundColor = ConsoleColor.Blue;
|
||||||
Console.Write(" • ");
|
Console.Write(" · ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,5 +103,4 @@ void FormattedLabRow(string line) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Console.ResetColor();
|
Console.ResetColor();
|
||||||
Console.WriteLine();
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue