public Maze1() { InitializeComponent(); BFSAlgorithm BFS = new BFSAlgorithm(new bool?[, ] { { false, false, false, false, false, false, false, false, false, false }, { false, null, null, null, null, false, null, null, null, false }, { false, false, null, false, false, false, null, null, null, false }, { false, null, null, false, null, null, null, null, null, false }, { false, null, null, null, null, null, null, null, null, false }, { false, false, false, false, false, false, null, false, false, false }, { false, null, null, null, null, null, null, false, null, true }, { false, null, false, false, false, false, null, false, null, false }, { false, null, null, null, null, null, null, null, null, false }, { false, false, false, false, false, false, false, false, false, false } }, CurrentRow, CurrentCoulmn); Solution = BFS.getSolution(); if (Solution != null) { T.Interval = 500; T.Elapsed += T_Elapsed; T.Enabled = true; } else { System.Windows.Forms.MessageBox.Show("No Solution"); } }
static void Main(string[] args) { BFSAlgorithm BFS = new BFSAlgorithm( new bool?[, ] { { false, null, true, null }, { null, null, false, false }, { null, false, null, true }, { null, false, null, null } }, 0, 0); Stack <Directions> Dirs = BFS.getSolution(); if (Dirs != null) { foreach (Directions D in Dirs) { Console.WriteLine(D.ToString()); } } else { Console.WriteLine("No Solution"); } Console.ReadKey(); }