-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPathTracker.cs
More file actions
41 lines (37 loc) · 1.13 KB
/
PathTracker.cs
File metadata and controls
41 lines (37 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
namespace KnowledgePath
{
class PathTracker
{
private readonly List<string> path = new List<string>();
public PathTracker(Tree tree, int UID)
{
string _path = tree.GetCategoryForSubject(UID);
path = new List<string>() { _path };
}
public void Add(Tree tree, int UID)
{
string _path = tree.GetCategoryForSubject(UID);
path.Add(_path);
}
public void PrintPath()
{
int depth = 0;
Console.WriteLine("You have reached the end of the tree for now, though it still grows.");
Console.WriteLine("Your path:");
foreach (string category in path)
{
for (int i = 0; i < depth; i++)
{
Console.Write("=");
}
Console.Write("> ");
Console.Write(category + "\n");
depth += 1;
}
Console.Write("\n");
Console.WriteLine("Press R to restart or any other key to close.");
}
}
}