コード例 #1
0
 public bool Contains(Move move, Percept percept)
 {
     if (perceptionData[move] == percept)
     {
         return(true);
     }
     return(false);
 }
コード例 #2
0
ファイル: Percept.cs プロジェクト: NelsonG6/BenderAndURL
        private readonly static List <Percept> list; //for counting

        //This might not be necessary

        static Percept()
        {
            Wall  = new Percept("Wall");
            Empty = new Percept("Empty");
            Can   = new Percept("Can");
            Enemy = new Percept("Enemy");

            list = new List <Percept>();
            list.Add(Wall);
            list.Add(Empty);
            list.Add(Can);
            list.Add(Enemy);
            Initialized = new Percept("initialized");
        }
コード例 #3
0
        static public void small_dropdownChanged(ComboBox changed_dropdown)
        {
            if (changed_dropdown.SelectedText != "None.")
            {
                PerceptionState to_set      = new PerceptionState(UnitType.Bender);
                Move            perceptMove = null;

                foreach (var i in Move.HorizontalMovesAndGrab)
                {
                    if (changed_dropdown == list_qmatrixComboboxes[i])
                    {
                        perceptMove = i;
                    }
                }

                //get the percept of the dropdown
                Percept keepFor_bestFit = (Percept)changed_dropdown.SelectedItem;

                //Build a perception state that matches the dropdowns
                foreach (var i in Move.HorizontalMovesAndGrab)
                {
                    to_set.perceptionData[i] = (Percept)list_qmatrixComboboxes[i].SelectedItem;
                }

                to_set.SetName();

                //This state may not exist in our q-matrix states, because we only changed one of the dropdowns.
                //The best solution i think is to make the other dropdowns find the most accurate state.
                //Compare all the states in the q-matrix, and display any that is tied for best matched.
                //Also, the matching state must have the same item as the dropdown we just changed.

                int             compare_value       = 0;
                int             temp                = 0;
                PerceptionState bestPerceptionstate = null;
                foreach (PerceptionState i in qmatrix_stateComboboxLarge.Items)
                {
                    temp = to_set.Compare(i);
                    if (temp > compare_value && i.Contains(perceptMove, keepFor_bestFit))
                    {
                        bestPerceptionstate = i;
                        compare_value       = temp;
                    }
                }

                ViewQmatrixConfiguration(bestPerceptionstate);
            }
        }