コード例 #1
0
    private void mock()
    {
        model = new EpistemicState();
        // creating Concept instances (actions)
        // available types: ACTION, OBJECT, PROPERTY
        // available modes: L, G
        Concept yesL = new Concept("posack", ConceptType.ACTION, ConceptMode.L);
        Concept yesG = new Concept("POSACK", ConceptType.ACTION, ConceptMode.G);
        Concept noL  = new Concept("negack", ConceptType.ACTION, ConceptMode.L);
        Concept noG  = new Concept("NEGACK", ConceptType.ACTION, ConceptMode.G);

        // add concepts to the epistemic model
        model.AddConcept(yesL);
        model.AddConcept(yesG);
        model.AddConcept(noL);
        model.AddConcept(noG);
        // add relations between them, third boolean param is bidirectional
        model.AddRelation(yesG, yesL, true);
        model.AddRelation(noG, noL, true);

        // now add more concepts (objects)
        Concept redBlock   = new Concept("RED", ConceptType.OBJECT, ConceptMode.L);
        Concept blueBlock  = new Concept("BLUE", ConceptType.OBJECT, ConceptMode.L);
        Concept greenBlock = new Concept("GREEN", ConceptType.OBJECT, ConceptMode.L);

        model.AddConcept(redBlock);
        model.AddConcept(blueBlock);
        model.AddConcept(greenBlock);

        model.SetEpisimUrl("http://localhost:5000");
    }
コード例 #2
0
    private void second_mock()
    {
        model = new EpistemicState();
        // creating Concept instances (actions)
        // available types: ACTION, OBJECT, PROPERTY
        // available modes: L, G
        Concept pushG  = new Concept("push", ConceptType.ACTION, ConceptMode.G);
        Concept rightL = new Concept("RIGHT", ConceptType.PROPERTY, ConceptMode.L);

        model.AddConcept(pushG);
        model.AddConcept(rightL);

        // now add more concepts (objects)

        model.SetEpisimUrl("http://localhost:5000");
    }
コード例 #3
0
    public void TestActualModel()
    {
        model = EpistemicModel.initModel();
        model.SetEpisimUrl("http://localhost:5000");
//		var json = Jsonifier.JsonifyEpistemicState(model);
//		Debug.Log(json);
        model.InitiateEpisim();
        var moveL = model.GetConcept("PUT", ConceptType.ACTION, ConceptMode.L);
        var pushL = model.GetConcept("PUSH", ConceptType.ACTION, ConceptMode.L);

        if ((moveL != null) && (pushL != null))
        {
            moveL.Certainty = -1;
            pushL.Certainty = -1;
            var json = Jsonifier.JsonifyEpistemicStateInitiation(model);
            Debug.Log(json);
            model.UpdateEpisim(new[] { moveL, pushL }, new Relation[] { });
        }
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        engaged = false;

        if (reuseModel)
        {
            idUser = true;
            userNameModalWindow            = gameObject.AddComponent <UserNameModalWindow>();
            userNameModalWindow.windowRect =
                new Rect(Screen.width / 2 - 185 / 2, Screen.height / 2 - 60 / 2, 185, 60);
            userNameModalWindow.Render          = true;
            userNameModalWindow.AllowDrag       = false;
            userNameModalWindow.AllowResize     = false;
            userNameModalWindow.AllowForceClose = false;
            userNameModalWindow.UserNameEvent  += IdentifyUser;
        }

        if (state == null)
        {
            state = initModel();
            Debug.Log(state);
        }


        if (PlayerPrefs.HasKey("URLs"))
        {
            string epiSimUrlString = string.Empty;
            foreach (string url in PlayerPrefs.GetString("URLs").Split(';'))
            {
                if (url.Split('=')[0] == "EpiSim URL")
                {
                    epiSimUrlString = url.Split('=')[1];
                    string epiSimUrl = !epiSimUrlString.StartsWith("http://")
                                                ? "http://" + epiSimUrlString
                                                : epiSimUrlString;
                    state.SetEpisimUrl(epiSimUrl);
                    state.InitiateEpisim();
                    break;
                }
            }
        }
    }