Beispiel #1
0
        public static void Main(string[] args)
        {
            bool   _quit;
            string _folderpath;

            _quit = false;
            Console.WriteLine("                --Inference Engine--                  ");
            Console.WriteLine("Set Path of folder containing tests: ");
            _folderpath = Console.ReadLine();
            do
            {
                Console.WriteLine("                --Inference Engine--                  ");
                string UserInput = Console.ReadLine();

                switch (UserInput)
                {
                case "Help":
                    Console.WriteLine("-------------------HELP---------------------\n\n\n");
                    Console.WriteLine("Commands:\n");
                    Console.WriteLine("Input Data example: iengine method filename");
                    Console.WriteLine("\n\n Problem Solving:\n");
                    Console.WriteLine("1: Make Sure the ");
                    Console.WriteLine("Exit the program: quit\n");

                    Console.Write("Press any key to close help menu: ");
                    Console.ReadKey();
                    break;

                case "quit":
                    quit = true;
                    break;
                }



                string[] UserSelection = UserInput.Split(' ');



                ReadTextFile data = new ReadTextFile(_folderpath + UserSelection[2]);

                switch (UserSelection[1])
                {
                case "TT":
                    TT Truthtable = new TT(data.Queries, data.AskVariable);
                    break;

                case "FC":
                    FC ForwardChaining = new FC(data.Queries, data.AskVariable);
                    break;

                case "BC":
                    BC BackWardChaining = new BC(data.Queries, data.AskVariable);
                    break;
                }
            }while(quit == false);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            if (args.Length == 2)
            {
                if (File.Exists(args[1]))
                {
                    /*
                     * Handle following in seperate class.
                     */
                    StreamReader sr    = File.OpenText(args[1]);
                    Regex        regex = new Regex("\\s+");

                    //LOOK FOR TELL
                    string input;

                    bool tellAsk = false;
                    while (!sr.EndOfStream)
                    {
                        input = sr.ReadLine();
                        if (regex.Replace(input, " ") == "TELL")
                        {
                            tell    = "";
                            tellAsk = true;
                        }
                        else if (regex.Replace(input, " ") == "ASK")
                        {
                            ask     = "";
                            tellAsk = false;
                        }
                        else
                        {
                            if (tellAsk)
                            { //TRUE TO READ INFRENCE;
                                tell += input;
                            }
                            else
                            { //FALSE TO PROCESS;
                                ask += input;
                            }
                        }
                    }
                    if (tell != null && ask != null)
                    {
                        //Trim Whitespace
                        tell = regex.Replace(tell, "");
                        ask  = regex.Replace(ask, "");
                    }
                    else
                    {
                        Console.Write("Missing TELL or ASK");
                        return;
                    }
                }
                else
                {
                    Console.Write("File does not exist.");
                    return;
                }

                switch (args[0].ToUpper())
                {
                case "TT":
                    TT truth = new TT(tell, ask);
                    break;

                case "FC":
                    FC forward = new FC(tell, ask);
                    break;

                case "BC":
                    BC backward = new BC(tell, ask);
                    break;

                default:
                    Console.Write("Invalid Method");
                    return;
                }
            }
            else
            {
                Console.WriteLine("INCOMPLETE ARGUMENTS");
                Console.Write("Please include the Method and A Valid File.");
            }
            return;
        }