Beispiel #1
0
        //This function will give bender perception data from the board
        public void UnitPercieves(UnitType toFind)
        {
            PerceptionState findPerception = new PerceptionState(toFind);

            foreach (var i in toFind.PerceptionCauses)
            {
                findPerception.perceptionData[i] = PercieveMove(i, toFind);
            }
            //Translated: for each move, percieve with this move, and update the perception for this move.

            findPerception.SetName();
            units[toFind].perceptionData = findPerception;
        }
Beispiel #2
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);
            }
        }