Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            Console.WriteLine("Prelude@# (" + version + ") command line version, welcome user!");
            Console.WriteLine("if you want to stop chatting, enter: 'exit'");
            //initialize interface
            PreLudeInterface pi = new PreLudeInterface();

            //configure prelude
            //define path to mind file
            pi.loadedMind = "mind.mdu";
            //decide whether you want true randomness
            pi.quantumRandomness = false;
            pi.isSpeaking        = true;
            pi.setProactiveMode(true);
            pi.avoidLearnByRepeating = true;

            pi.initializedAssociater = Mind.MatchingAlgorithm.Dice;

            //start your engine ...
            pi.initializeEngine();
            //here we go:
            while (!ind.StartsWith("exit"))
            {
                Console.Write("You say: ");
                ind = Console.ReadLine();
                logger.Trace("You say: " + ind);
                string answer = pi.chatWithPrelude(ind);
                Console.WriteLine("Prelude says: " + answer);
                logger.Trace("Prelude says: " + answer);
            }
            pi.stopPreludeEngine();
        }
Exemplo n.º 2
0
 private void OnConversationReceived(Conversation sender, MessageEventArgs e)
 {
     Console.Text = sender.Messenger.Owner.Name + "User said: " + e.Message.Text;
     ind          = pi.chatWithPrelude(e.Message.Text);
     Console.Text = "I, Prelude, say: " + ind;
     sender.SendMessage(ind);
     if (e.Message.Text == "exit__")
     {
         pi.stopPreludeEngine();
     }
 }
Exemplo n.º 3
0
        private void doChatting()
        {
            idleControl.Stop();
            string output = "";

            presentLine++;
            string cleanInputText = inputBox.Text.Trim('\n');

            output = pi.chatWithPrelude(cleanInputText);
            outputBox.AppendText("You: \t" + cleanInputText);
            GoToLineAndColumn(outputBox, presentLine, 0);
            outputBox.SelectionColor = Color.Orange;
            outputBox.AppendText("\n");
            presentLine++;
            if (Character != null && lastAgent != "")
            {
                outputBox.AppendText(Character.Name + ": \t" + output);
            }
            else
            {
                outputBox.AppendText("CPU: \t" + output);
            }
            GoToLineAndColumn(outputBox, presentLine, 0);
            outputBox.SelectionColor = Color.Blue;
            outputBox.AppendText("\n");
            outputBox.Focus();
            inputBox.Text = "";
            inputBox.Focus();
            try
            {
                if (this.Character != null && enabledAgent == true)
                {
                    charReq = this.Character.Speak(output, null);
                }
            }
            catch (System.Exception e)
            {
                MessageBox.Show("Error occured: " + e.ToString());
            }
            idleControl.Start();
        }
Exemplo n.º 4
0
        public static void Main(string[] args)
        {
            Console.WriteLine("going to test PLE");
            //initialize interface
            PreLudeInterface pi = new PreLudeInterface();

            //define path to mind file
            pi.loadedMind = "mind.mdu";
            //start your engine ...
            pi.initializeEngine();
            //here we go:
            Console.WriteLine("You say: " + "hello Prelude");
            Console.WriteLine("Prelude says: " + pi.chatWithPrelude("hello Prelude"));
            pi.stopPreludeEngine();
        }
Exemplo n.º 5
0
        public void Skype_MessageStatus(IChatMessage ichatmessage, TChatMessageStatus Status)
        {
            // Write Message Status to Window
            //if (ichatmessage.Type  == TChatMessageType.cmeSaid)
            //    return;
            if ((ichatmessage.Status != TChatMessageStatus.cmsReceived))
            {
                return;
            }

            this.textBox1.AppendText("Message Status: " + skype.Convert.ChatMessageStatusToText(Status));
            this.textBox1.AppendText(" - " + Status.ToString() + Environment.NewLine);
            string botsAnswer = pi.chatWithPrelude(ichatmessage.Body);

            this.textBox1.AppendText("Prelude: " + botsAnswer);
            ichatmessage.Chat.SendMessage(botsAnswer);
            this.textBox1.ScrollToCaret();
        }
Exemplo n.º 6
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Prelude@# (0.5.0) command line version, welcome user!");
            Console.WriteLine("if you want to stop chatting, enter: 'exit'");
            //initialize interface
            PreLudeInterface pi = new PreLudeInterface();

            //define path to mind file
            pi.loadedMind = "mind.mdu";
            //start your engine ...
            pi.initializeEngine();
            //here we go:
            while (!ind.StartsWith("exit"))
            {
                Console.Write("You say: ");
                ind = Console.ReadLine();
                Console.WriteLine("Prelude says: " + pi.chatWithPrelude(ind));
            }
            pi.stopPreludeEngine();
        }
Exemplo n.º 7
0
 private static void iamBored(string a)
 {
     Console.WriteLine("\n" + "Prelude to herself: " + a);
     Console.WriteLine("Prelude bored: " + pi.chatWithPrelude(a));
 }
Exemplo n.º 8
0
 public static void delegateMessageToPrelude(IrcEventArgs e)
 {
     latest = e;
     //collect users
     if (!sl.Contains(e.Data.Nick))
     {
         sl.Add(e.Data.Nick, e.Data.Ident);
     }
     if (e.Data.Message.StartsWith("cmd:"))
     {
         listenToCommands(e);
     }
     else
     {
         if ((e.Data.Nick == TargetUser) || allowAny)
         {
             string ind = e.Data.Message;
             string a   = "";
             if (allowPrivateMessages)
             {
                 if (proactiveMode)
                 {
                     idleTime = 0;
                     if (timer != null)
                     {
                         timer.Stop();
                     }
                 }
                 a = pi.chatWithPrelude(ind);
                 irc.SendMessage(SendType.Message, e.Data.Nick, a);
                 if (relayChat)
                 {
                     irc.SendMessage(SendType.Message, Spy, ind);
                     irc.SendMessage(SendType.Message, Spy, a);
                 }
                 if (proactiveMode)
                 {
                     Random random = new Random();
                     idleTime       = random.Next(15000, 30000);
                     timer.Interval = idleTime;
                     autoSpeakInput = a;
                     timer.Start();
                 }
             }
             else if (allowPublicMessages)
             {
                 a = pi.chatWithPrelude(ind);
                 irc.SendMessage(SendType.Message, e.Data.Channel, "@" + TargetUser + ": " + a);
                 if (relayChat)
                 {
                     irc.SendMessage(SendType.Message, Spy, ind);
                     irc.SendMessage(SendType.Message, Spy, a);
                 }
             }
         }
         else if (floodChannel)
         {
             if (allowPublicMessages)
             {
                 string ind = e.Data.Message;
                 string a   = "";
                 irc.SendMessage(SendType.Message, e.Data.Channel, "@" + TargetUser + ": " + a);
             }
         }
     }
 }