Esempio n. 1
0
        private string GetAntecedentJsonByRule(KB.Rule rule)
        {
            string json = "{ ";

            foreach (IList <Judgment> judgments in rule.Antecedent.JudgmentDictionary.Values)
            {
                if (judgments.Count == 1)
                {
                    Judgment j = judgments.First();
                    json += String.Format(@"""AND"": [ ""{0} — {1}"" ], ", j.Title, j.FuzzyValue);
                }
                else
                {
                    json += "\"OR\": [";
                    foreach (Judgment j in judgments)
                    {
                        json += String.Format(@" ""{0} — {1}"",", j.Title, j.FuzzyValue);
                    }
                    json = json.TrimEnd(',');

                    json += " ], ";
                }
            }
            json  = json.TrimEnd(new char[] { ' ', ',' });
            json += " }";

            return(json);
        }
Esempio n. 2
0
        private KB.Rule GetRule03()
        {
            Antecedent antecedent;
            Judgment   consequent;

            antecedent = new Antecedent()
                         .OR(new Judgment(FactorTitle.Uimp, FactorFuzzyValue.Nominal))
                         .AND(new Judgment(FactorTitle.dUabc, FactorFuzzyValue.Nominal))
                         .AND(new Judgment(FactorTitle.Uns, FactorFuzzyValue.Nominal))
                         .AND(new Judgment(FactorTitle.K2U, FactorFuzzyValue.Nominal))
                         .AND(new Judgment(FactorTitle.K2Ui, FactorFuzzyValue.Successful))
                         .AND(new Judgment(FactorTitle.dt, FactorFuzzyValue.Successful));
            consequent = new Judgment(FactorTitle.ServiceabilityEquipment, FactorFuzzyValue.Nominal);

            LinguisticVariable linguistic = new LinguisticVariable(
                FactorTitle.ServiceabilityEquipment,
                null,
                new List <FactorFuzzyValue> {
                FactorFuzzyValue.Nominal, FactorFuzzyValue.Maximum, FactorFuzzyValue.Exceeding
            },
                "Исправность технического состояния оборудования",
                null
                );

            return(new SimpleRule(linguistic, antecedent, consequent));
        }
Esempio n. 3
0
        public async Task <bool> DestroyTotem(WoWUnit totem)
        {
            if (totem == null)
            {
                return(false);
            }

            Helpers.Logger.PrintLog(Colors.Red, "Totem Stomp on {1}", totem.Name);

            if (SpellManager.CanCast(Judgment.CRSpell, totem, true))
            {
                return(await Judgment.Cast(totem));
            }

            if (SpellManager.CanCast(AvengersShield.CRSpell, totem, true))
            {
                return(await AvengersShield.Cast(totem));
            }

            if (SpellManager.CanCast(HammerOfRighteous.CRSpell, totem, true))
            {
                return(await HammerOfRighteous.Cast(totem));
            }

            if (SpellManager.CanCast(ShieldOfTheRighteous.CRSpell, totem, true))
            {
                return(await ShieldOfTheRighteous.Cast(totem));
            }

            return(false);
        }
Esempio n. 4
0
        private KB.Rule GetRule12()
        {
            Antecedent antecedent;
            Judgment   consequent;

#pragma warning disable CS0168 // Переменная "other" объявлена, но ни разу не использована.
            Judgment other;
#pragma warning restore CS0168 // Переменная "other" объявлена, но ни разу не использована.

            antecedent = new Antecedent()
                         .OR(new Judgment(FactorTitle.Ua, FactorFuzzyValue.Maximum), new Judgment(FactorTitle.Ub, FactorFuzzyValue.Maximum), new Judgment(FactorTitle.Uc, FactorFuzzyValue.Maximum))
                         .OR(new Judgment(FactorTitle.Ua, FactorFuzzyValue.Maximum), new Judgment(FactorTitle.Ua, FactorFuzzyValue.Nominal))
                         .OR(new Judgment(FactorTitle.Ub, FactorFuzzyValue.Maximum), new Judgment(FactorTitle.Ua, FactorFuzzyValue.Nominal))
                         .OR(new Judgment(FactorTitle.Uc, FactorFuzzyValue.Maximum), new Judgment(FactorTitle.Ua, FactorFuzzyValue.Nominal))
                         .AND(new Judgment(FactorTitle.Weather, FactorFuzzyValue.Unsuccessful));
            consequent = new Judgment(FactorTitle.Uimp, FactorFuzzyValue.Maximum);

            LinguisticVariable linguistic = new LinguisticVariable(
                FactorTitle.Uimp,
                null,
                new List <FactorFuzzyValue> {
                FactorFuzzyValue.Nominal, FactorFuzzyValue.Maximum, FactorFuzzyValue.Exceeding
            },
                "Грозовые импульсные напряжения",
                "В"
                );
            return(new SimpleRule(linguistic, antecedent, consequent));
        }
Esempio n. 5
0
        public async Task <bool> DestroyTotem(WoWUnit totem)
        {
            if (totem == null)
            {
                return(false);
            }

            Helpers.Logger.PrintLog("Totem Stomp on " + totem.Name);

            if (SpellManager.CanCast(Judgment.CRSpell, totem, true))
            {
                return(await Judgment.Cast(totem));
            }

            if (SpellManager.CanCast(BladeOfWrath.CRSpell, totem, true))
            {
                return(await BladeOfWrath.Cast(totem));
            }

            if (SpellManager.CanCast(CrusaderStrike.CRSpell, totem, true))
            {
                return(await CrusaderStrike.Cast(totem));
            }

            if (SpellManager.CanCast(Zeal.CRSpell, totem, true))
            {
                return(await Zeal.Cast(totem));
            }

            return(false);
        }
 public EnglishWordSentiment(string word, string valence,
                             string stateIntensity, string emotion, string judgment,
                             string agreement, string intention)
 {
     Word = word;
     if (!Enum.TryParse(valence, out this.valence))
     {
         this.valence = Valence.NULL;
     }
     if (!Enum.TryParse(stateIntensity, out this.stateIntensity))
     {
         this.stateIntensity = StateIntensity.NULL;
     }
     if (!Enum.TryParse(emotion, out this.emotion))
     {
         this.emotion = Emotion.NULL;
     }
     if (!Enum.TryParse(judgment, out this.judgment))
     {
         this.judgment = Judgment.NULL;
     }
     if (!Enum.TryParse(agreement, out this.agreement))
     {
         this.agreement = Agreement.NULL;
     }
     if (!Enum.TryParse(intention, out this.intention))
     {
         this.intention = Intention.NULL;
     }
 }
Esempio n. 7
0
    // 出牌
    public void PassCards()
    {
        // 獲得選中的牌
        List <Card> card = Judgment.CheckSelectCards(deck);

        // 將牌組丟出去(ui)
        SelectCardsSetTable(card);

        // 移除手中擁有的牌(data)
        foreach (var item in card)
        {
            RemoveCardsFromList(item);
        }

        // 通知審局函數判斷是否有贏家
        if (gamescene.IsGameEnd(this))
        {
            return;
        }

        // 將牌重新排序
        SortHandCards();

        // 將按鈕變回無法出牌的樣子
        UIManger.btn_PassCards.interactable = false;

        // 出牌後隱藏
        UIManger.HideCardTypeView();

        // 換人出牌
        if (gamescene.m_state != GameState.GameEnd)
        {
            gamescene.NotifyManger.ChangeNextPlayer();
        }
    }
Esempio n. 8
0
 public void Score(Judgment judgment)
 {
     JudgementObj.GetComponent <Animation>().Stop();
     JudgementObj.GetComponent <Animation>().Play();
     if (judgment == Judgment.Perfect)
     {
         JudgementObj.GetComponent <Image>().sprite = perfect;
         JudgementObj.GetComponent <Image>().SetNativeSize();
         score        += 100;
         perfectCount += 1;
     }
     else if (judgment == Judgment.Good)
     {
         JudgementObj.GetComponent <Image>().sprite = good;
         JudgementObj.GetComponent <Image>().SetNativeSize();
         score     += 50;
         goodCount += 1;
     }
     else if (judgment == Judgment.Bad)
     {
         JudgementObj.GetComponent <Image>().sprite = bad;
         JudgementObj.GetComponent <Image>().SetNativeSize();
         score    += 30;
         badCount += 1;
     }
     else if (judgment == Judgment.Miss)
     {
         JudgementObj.GetComponent <Image>().sprite = miss;
         JudgementObj.GetComponent <Image>().SetNativeSize();
         missCount += 1;
     }
 }
Esempio n. 9
0
 // Use this for initialization
 void Start()
 {
     s1 = SSDirector.getInstance();
     s1.setModel(this);
     load();
     judegement    = new Judgment(leftPriests, rightPriests, leftDevils, rightDevils, ship, s1);
     actionManager = gameObject.AddComponent <MySceneActionManager>() as MySceneActionManager;
 }
Esempio n. 10
0
        private string GetConsequentJsonByRule(KB.Rule rule)
        {
            string   json = "";
            Judgment j    = rule.Consequent;

            json += String.Format(@"""{0} — {1}""", j.Title, j.FuzzyValue);

            return(json);
        }
        public void Add(ILinguisticVariable linguisticVar)
        {
            Judgment judgment = new Judgment(linguisticVar.Title, linguisticVar.FuzzyValue);

            FactorsOutput[iteration].Add(judgment);
            allFactors.Add(judgment);

            LinguisticVariablesOutput[iteration].Add(linguisticVar);
        }
Esempio n. 12
0
        public async Task <bool> JudgmentMethod()
        {
            if (!await Judgment.Cast(Globals.CurrentTarget))
            {
                return(false);
            }

            LastSpell = Judgment;
            return(true);
        }
        private void AddRule(object obj)
        {
            LinguisticVariable linguistic = (LinguisticVariable)linguistics.Where(lv => lv.Title == ConsequentM.SelectedTitle).First();
            Antecedent         antecedent = AntecedentM.Make();
            Judgment           consequent = ConsequentM.Make();

            Rule newRule = new SimpleRule(linguistic, antecedent, consequent);

            SaveToDB(newRule);
        }
Esempio n. 14
0
        bool CheckShouldKeepComboFromJudgment(Judgment judgment)
        {
            switch (judgment)
            {
            case Judgment.Perfect:
            case Judgment.Great:
            case Judgment.Good: return(true);

            default: return(false);
            }
        }
Esempio n. 15
0
 public static bool validateJudgment(Judgment judgment)
 {
     if (judgment.color.Length != 4)
     {
         Console.WriteLine("Judgment \"" + judgment.text + "\" with threshold " + judgment.threshold +
                           "has invalid color!");
         Console.WriteLine("Make sure to include exactly 4 numbers for each judgment's color!");
         return(false);
     }
     return(true);
 }
Esempio n. 16
0
        public JudgmentUserControlViewModel()
        {
            Judgment judgment = Judgment.Instance;

            this.千点棒 = judgment.ObserveProperty(x => x.Bou1000).ToReactiveProperty();
            this.本場  = judgment.ObserveProperty(x => x.Bou100).ToReactiveProperty();
            this.局面  = judgment.ObserveProperty(x => x.Ba).ToReactiveProperty();

            this.局面操作 = new DelegateCommand <string>((e) => judgment.BaControl(e));
            this.流局   = new DelegateCommand(() => judgment.Ryukyoku());
        }
Esempio n. 17
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
        private void SetEditedRule()
        {
            if (AntecedentM != null && ConsequentM != null)
            {
                LinguisticVariable linguistic = SelectedRule.LinguisticVariable;
                Antecedent         antecedent = AntecedentM.Make();
                Judgment           consequent = ConsequentM.Make();

                editedRule = new SimpleRule(linguistic, antecedent, consequent);
            }
        }
Esempio n. 19
0
    // 清除所有物件
    public void ClearAllObjects()
    {
        //把場上所有牌清除
        ClearAllCards();

        //將檯面的牌組給清除
        Judgment.ResetTopCard();

        //將選擇牌型介面隱藏
        btn_PassCards.interactable = false;
        HideCardTypeView();
    }
 public EnglishWordSentiment(string word, Valence valence,
                             StateIntensity stateIntensity, Emotion emotion, Judgment judgment,
                             Agreement agreement, Intention intention)
 {
     Word                = word;
     this.valence        = valence;
     this.stateIntensity = stateIntensity;
     this.emotion        = emotion;
     this.judgment       = judgment;
     this.agreement      = agreement;
     this.intention      = intention;
 }
Esempio n. 21
0
        void FlashJudgment(Judgment judgment)
        {
            string str = GetJudgmentText(judgment);

            judgmentText.text = str;
            var color = GetJudgmentColor(judgment);

            judgmentText.color = color;
            anim_.New(judgmentText)
            .ScaleFromTo(judgmentText.transform, new Vector3(1.1f, 1.1f, 1.1f), Vector3.one, .2f, 0)
            .FadeFromTo(judgmentText, 1, .5f, .2f, 0);
            progressBar.SetStrock(color);
        }
Esempio n. 22
0
        ParticleBurstEmitter GetParticleEmitterFromJudgment(Judgment judgment)
        {
            switch (judgment)
            {
            case Judgment.Perfect: return(perfectEmitter);

            case Judgment.Great: return(greatEmitter);

            case Judgment.Good: return(goodEmitter);

            default: return(badEmitter);
            }
        }
Esempio n. 23
0
    private Judgment judgment;                       //添加裁判
    void Awake()
    {
        Director director = Director.getInstance();

        director.currentSceneController = this;
        userGUI    = gameObject.AddComponent <UserGUI>() as UserGUI;
        characters = new MyCharacterController[6];

        myActionManager           = gameObject.AddComponent <FirstSceneActionManager>() as FirstSceneActionManager; //动作管理器部件获取
        judgment                  = gameObject.AddComponent <Judgment>() as Judgment;                               //裁判获取
        camera                    = GameObject.Find("Main Camera");
        camera.transform.position = new Vector3(0, 3, -15);
        loadResources();
    }
Esempio n. 24
0
    // 將牌桌上的牌重置
    private void SelectCardsSetTable(List <Card> cards)
    {
        if (cards.Count > 0)
        {
            for (int i = 0; i < cards.Count; i++)
            {
                cards[i].gameObject.transform.GetComponent <Card>().SetCardCancel();
                cards[i].gameObject.transform.GetComponent <Card>().CardImageShow();
            }
        }

        UIManger.ResetCardsOfTable(cards);
        Judgment.SetTopCard(cards);
    }
Esempio n. 25
0
    private List <Card> GetCanPassCardForHard()
    {
        List <Card> PassCard      = new List <Card>();
        var         lastCards     = Judgment.GetLastTableCards();
        var         lastCardsType = Judgment.CheckCardType(lastCards);


        if (gamescene.m_player[0].deck.transform.childCount < 7)
        {
            return(GetCanPassCard_2());
        }

        return(_GetCanPassCardForHard());
    }
Esempio n. 26
0
        //float GetJudgmentScoreMultiplier(Judgment judgment) {
        //	switch (judgment) {
        //		case Judgment.Perfect: return 1f;
        //		case Judgment.Great: return .8f;
        //		case Judgment.Good: return .4f;
        //		case Judgment.Bad: return .2f;
        //		default: return 0;
        //	}
        //}

        float GetJudgmentAccuracyContribution(Judgment judgment)
        {
            switch (judgment)
            {
            case Judgment.Perfect: return(300);

            case Judgment.Great: return(200);

            case Judgment.Good: return(100);

            case Judgment.Bad: return(50);

            default: return(0);
            }
        }
Esempio n. 27
0
        string GetJudgmentText(Judgment judgment)
        {
            switch (judgment)
            {
            case Judgment.Perfect: return("PERFECT");

            case Judgment.Great: return("GREAT");

            case Judgment.Good: return("GOOD");

            case Judgment.Bad: return("BAD");

            default: return("MISS");
            }
        }
Esempio n. 28
0
        private KB.Rule GetRuleFromDataTableRow(DataColumnCollection columns, DataRow row)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            for (int col = 0; col < columns.Count; col++)
            {
                data.Add(columns[col].ColumnName, row[col]);
            }

            LinguisticVariable linguisticVariable = GetLinguisticVariableFromDataTableRow(columns, row);
            Antecedent         antecedent         = GetAntecedentFromJson(data["Antecedent"].ToString());
            Judgment           consequent         = GetJudgmentFromJson(data["Consequent"].ToString());

            return(new SimpleRule(linguisticVariable, antecedent, consequent));
        }
Esempio n. 29
0
        private Judgment GetJudgmentFromJson(string json)
        {
            if (String.IsNullOrEmpty(json))
            {
                return(null);
            }

            json = json.Trim(new char[] { '\\', '"', ' ' });

            Judgment judgment = GetJudgmentListFromString(new List <string> {
                json
            }).First();

            return(judgment);
        }
Esempio n. 30
0
        Color GetJudgmentColor(Judgment judgment)
        {
            switch (judgment)
            {
            case Judgment.Perfect: return(perfectColor);

            case Judgment.Great: return(greatColor);

            case Judgment.Good: return(goodColor);

            case Judgment.Bad: return(badColor);

            default: return(missColor);
            }
        }
Esempio n. 31
0
 public static void AddJudge(Judgment judge)
 {
     paper.Add(judge);
 }
Esempio n. 32
0
        private List<Judgment> DataSetToListJudgment(DataSet Ds)
        {
            DataTable p_Data = Ds.Tables[0];
            // 返回值初始化
            List<Judgment> result = new List<Judgment>();
            for (int j = 0; j < p_Data.Rows.Count; j++)
            {
                Judgment problem = new Judgment();
                problem.problemId = Convert.ToInt32(p_Data.Rows[j]["PID"]);
                problem.problem = p_Data.Rows[j]["PContent"].ToString();
                problem.ans = p_Data.Rows[j]["Answer"].ToString();
                problem.unit.UnitId = Convert.ToInt32(p_Data.Rows[j]["Unit"]);
                problem.unit.UnitName = p_Data.Rows[j]["UnitName"].ToString();
                problem.Plevel = Convert.ToInt32(p_Data.Rows[j]["PLevel"]);

                result.Add(problem);
            }
            return result;
        }
Esempio n. 33
0
 public List<Judgment> GetJudgeProbelms()
 {
     List<Judgment> list = new List<Judgment>();
     foreach (XmlNode xnn in xd.ChildNodes.Item(1).ChildNodes)
     {
         if (xnn.Name == "Judgment")
         {
             Judgment c = new Judgment();
             c.problemId = Convert.ToInt32(xnn.Attributes["ProblemId"].Value);
             c.orderId = Convert.ToInt32(xnn.Attributes["OrderId"].Value);
             foreach (XmlNode option in xnn.ChildNodes)
             {
                 if (option.ChildNodes.Item(0) != null)
                 {
                     switch (option.Name)
                     {
                         case "Problem":
                             c.problem = option.ChildNodes.Item(0).Value;
                             break;
                     }
                 }
             }
             list.Add(c);
         }
     }
     return list;
 }