Skip to content

Commit 873f37e

Browse files
committed
better visual
1 parent 62002b3 commit 873f37e

14 files changed

+271
-62
lines changed

Diff for: .vs/PathAlgorithms/v16/.suo

10 KB
Binary file not shown.

Diff for: .vs/PathAlgorithms/v16/Server/sqlite3/storage.ide

4 KB
Binary file not shown.
0 Bytes
Binary file not shown.
1.95 MB
Binary file not shown.

Diff for: BFS.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public Tuple<List<Tuple<int,int>>,List<Tuple<int,int>>> get_BFS_path()
9797

9898
if (curr.Item1 == endX && curr.Item2 == endY) // if the target found break
9999
{
100-
MessageBox.Show(curr.Item3.ToString()+" steps");
100+
//MessageBox.Show(curr.Item3.ToString()+" steps");
101101
found = true;
102102
break;
103103
}

Diff for: DFS.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ public void performDFS(Tuple<int,int,int> currentCell)
7676
toReturn.Add(toAppend);
7777
if (currX == endX && currY == endY)
7878
{
79-
MessageBox.Show(currentCell.Item3.ToString() + " steps"); // number of steps
79+
//MessageBox.Show(currentCell.Item3.ToString() + " steps"); // number of steps
8080
return;
8181
}
8282

83-
for(int i = 0; i < 8; i++) // explore the neighbour cellsC:\Users\Lazaron Shyta\source\repos\PathAlgorithms\DFS.cs
83+
for(int i = 0; i < 8; i++) // explore the neighbour cells
8484
{
8585
int nextX = currX + d1[i];
8686
int nextY = currY + d2[i];

Diff for: Form1.Designer.cs

+240-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Form1.cs

+28-29
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public partial class Form1 : Form
1616
public Form1()
1717
{
1818
InitializeComponent();
19-
19+
runDFS.Enabled = false;
20+
runBFS.Enabled = false;
2021
prepareBoard();
2122
}
2223

@@ -39,34 +40,8 @@ void enableButtons()
3940
clear.Enabled = true;
4041

4142
}
42-
void prompt_user()
43-
{
44-
int height_SZ = board.Rows.Count;
45-
int width_SZ = board.Columns.Count;
46-
MessageBox.Show("Please select the starting cell...");
47-
for (int i = 0; i < width_SZ; i++)
48-
{
49-
for (int j = 0; j < height_SZ; j++)
50-
{
51-
if (board[i, j].Selected)
52-
{
53-
startX = i;startY = j;
54-
}
55-
}
56-
}
57-
MessageBox.Show("Please select the ending cell...");
58-
59-
for (int i = 0; i < width_SZ; i++)
60-
{
61-
for (int j = 0; j < height_SZ; j++)
62-
{
63-
if (board[i, j].Selected)
64-
{
65-
endX = i; endY = j;
66-
}
67-
}
68-
}
69-
}
43+
44+
7045

7146
private void CloseButton_Click(object sender, EventArgs e)
7247
{
@@ -192,6 +167,29 @@ private void Select_Click(object sender, EventArgs e)
192167
}
193168
}
194169

170+
private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
171+
{
172+
173+
}
174+
175+
// select start and end button
176+
private void Button1_Click(object sender, EventArgs e)
177+
{
178+
startY = Int32.Parse(startLISTx.SelectedItem.ToString())-1;
179+
startX = Int32.Parse(startLISTy.SelectedItem.ToString())-1;
180+
endY = Int32.Parse(endLISTx.SelectedItem.ToString())-1;
181+
endX = Int32.Parse(endLISTy.SelectedItem.ToString())-1;
182+
if(startX==endX && startY == endY)
183+
{
184+
MessageBox.Show("Please check coordinates...");
185+
}
186+
else
187+
{
188+
runBFS.Enabled = true;
189+
runDFS.Enabled = true;
190+
}
191+
}
192+
195193
private void RunBFS_Click(object sender, EventArgs e)
196194
{
197195
List<int> xWalls = new List<int>();
@@ -216,6 +214,7 @@ private void RunBFS_Click(object sender, EventArgs e)
216214
MessageBox.Show("Now showing the shortest path...");
217215
ColorTheBoard(shortestPath, true);
218216
}
217+
pathCount.Text = (shortestPath.Count()-1).ToString()+ " steps";
219218

220219
}
221220

Diff for: bin/Debug/PathAlgorithms.exe

3 KB
Binary file not shown.

Diff for: bin/Debug/PathAlgorithms.pdb

2 KB
Binary file not shown.
0 Bytes
Binary file not shown.
-1.91 KB
Binary file not shown.

Diff for: obj/Debug/PathAlgorithms.exe

3 KB
Binary file not shown.

Diff for: obj/Debug/PathAlgorithms.pdb

2 KB
Binary file not shown.

0 commit comments

Comments
 (0)