예제 #1
0
        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());
            }
        }
예제 #2
0
        /// <summary>
        /// A utility method to turn the users entered method into a method type
        /// </summary>
        /// <param name="Method">The method the user entered</param>
        /// <param name="output">a boolean representing if the user selected output or not</param>
        /// <returns>SearchClass</returns>
        private static SearchClass GetSearchType(string Method, bool output)
        {
            SearchClass SearchClass = new ForwardsChaining();

            switch (Method.ToUpper())
            {
            case "FC":
            case "FORWARDSCHAINING":
                break;

            case "BC":
            case "BACKWARDSCHAINING":
                SearchClass = new BackwardsChaining();
                break;

            case "TT":
            case "TRUTHTABLE":
            case "TRUTHTABLECHECKING":
                SearchClass = new TruthTable(output);
                break;
            }
            return(SearchClass);
        }