Exemplo n.º 1
0
        private void ConnectButton_Click(object sender, EventArgs e)
        {
            string x = System.IO.Directory.GetCurrentDirectory();

            // create connection to Soar
            kernel = sml.Kernel.CreateRemoteConnection();

            // report failed connection
            if (kernel.HadError())
            {
                TextView.Text = "Error connecting to Soar";
            }

            // read list of agents
            agentNames.Clear();
            for (int i = 0; i < kernel.GetNumberAgents(); i++)
            {
                agentNames.Add(kernel.GetAgentByIndex(i).GetAgentName());
                // TODO this should be able to read from agentNames but it's not
            }
            // set drop-down data source
            AgentList.DataSource = agentNames;
            // select first agent if it exists
            if (kernel.GetNumberAgents() > 0)
            {
                // TODO I don't we have to set agent here because SelectedIndexChanged will fire
                //agent = kernel.GetAgentByIndex(0);
                AgentList.SelectedIndex = 0;
            }

            sml.ConnectionInfo ci = kernel.GetConnectionInfo(0);
        }
Exemplo n.º 2
0
        private void ConnectButton_Click(object sender, EventArgs e)
        {
            string x = System.IO.Directory.GetCurrentDirectory();
            // create connection to Soar
            kernel = sml.Kernel.CreateRemoteConnection();

            // report failed connection
            if (kernel.HadError())
            {
                TextView.Text = "Error connecting to Soar";
            }

            // read list of agents
            agentNames.Clear();
            for (int i = 0; i < kernel.GetNumberAgents(); i++)
            {
                agentNames.Add(kernel.GetAgentByIndex(i).GetAgentName());
                // TODO this should be able to read from agentNames but it's not
            }
            // set drop-down data source
            AgentList.DataSource = agentNames;
            // select first agent if it exists
            if (kernel.GetNumberAgents() > 0)
            {
                // TODO I don't we have to set agent here because SelectedIndexChanged will fire
                //agent = kernel.GetAgentByIndex(0);
                AgentList.SelectedIndex = 0;
            }

            sml.ConnectionInfo ci = kernel.GetConnectionInfo(0);
        }
Exemplo n.º 3
0
        private void startKernelButton_Click(object sender, EventArgs e)
        {
            // create kernel
            kernel = sml.Kernel.CreateKernelInNewThread();

            // TODO handle error
            if (kernel.HadError())
            {
                return;
            }

            // create agent
            agent = kernel.CreateAgent("blue");
            if (agent.HadError())
            {
                return;
            }
            // load rules
            agent.LoadProductions(@"..\..\..\..\soar-blokus.soar");

            // register for output
            handleOutput = new sml.Kernel.UpdateEventCallback(HandleAgentOuput);
            kernel.RegisterForUpdateEvent(sml.smlUpdateEventId.smlEVENT_AFTER_ALL_OUTPUT_PHASES, handleOutput, null);
        }
Exemplo n.º 4
0
        private void startKernelButton_Click(object sender, EventArgs e)
        {
            // create kernel
            kernel = sml.Kernel.CreateKernelInNewThread();

            // TODO handle error
            if (kernel.HadError())
            {
                return;
            }

            // create agent
            agent = kernel.CreateAgent("blue");
            if (agent.HadError())
            {
                return;
            }
            // load rules
            agent.LoadProductions(@"..\..\..\..\soar-blokus.soar");

            // register for output
            handleOutput = new sml.Kernel.UpdateEventCallback(HandleAgentOuput);
            kernel.RegisterForUpdateEvent(sml.smlUpdateEventId.smlEVENT_AFTER_ALL_OUTPUT_PHASES, handleOutput, null);
        }