static void Main(string[] args) { //ForwardChaining fc = new ForwardChaining("green", "croaks&flies=>frog;chirps&sings=>canary;frog=>green;canary=>yellow;croaks;flies;"); //Console.WriteLine(fc.Execute()); string[] file = System.IO.File.ReadAllLines(String.Format(@"C:\Assignments\{0}", args[1])); string tell = file[1]; string ask = file[3]; if (args[0] == "TT") { TruthTable TT = new TruthTable(ask, tell); Console.WriteLine(TT.Execute()); } else if (args[0] == "FC") { ForwardChaining FC = new ForwardChaining(ask, tell); Console.WriteLine(FC.Execute()); } else if (args[0] == "BC") { BackwardsChaining BC = new BackwardsChaining(ask, tell); Console.WriteLine(BC.Execute()); } }
static void Main(string[] args) { // Usage: iengine method filename // Methods: TT / FC / BC // New Usage: // iengine method filename (Any triggers GUI) bool guiEnabled = false; if (args.Length < 1) { throw new Exception("Not enough arguments! Usage: iengine [Method] [Filename] [GUI: Yes/No]"); } if (args.Length > 2) { guiEnabled = true; } // Create modules and assign connections TextParser parser = new TextParser(args[1]); Console.WriteLine($"ASK: {parser.Ask} | TELL: {parser.Tell}"); KnowledgeBase KB; switch (args[0].ToLower()) { case "bc": KB = new BackwardChaining(parser.Ask, parser.Tell); break; case "fc": KB = new ForwardChaining(parser.Ask, parser.Tell); break; default: KB = new TruthTable(parser.Ask, parser.Tell); break; } Console.WriteLine($"KB Output: {KB.Execute()}"); if (guiEnabled) { SFMLView _view = new SFMLView(ref KB); while (!_view.IsFinished) { _view.Draw(); } _view.Close(); } }