// Import from XML with DataContract
        public void ImportData(FileStream inStream)
        {
            // Deserialize fs into disc
            Discovered disc = null;
            var        dcs  = new DataContractSerializer(typeof(Discovered));

            using (var reader = XmlDictionaryReader.CreateTextReader(inStream, new XmlDictionaryReaderQuotas()))
                disc = (Discovered)dcs.ReadObject(reader, true);

            // Copy relevant members
            stateValues = disc.stateValues;
        }
Exemple #2
0
 public override string ToString() => Discovered.ToString();
Exemple #3
0
 // Use GoalTest to invoke appropriate behaviors
 public IState Act(List <IState> successorStates)
 {
     // Return the next best option
     return(Discovered.ChooseSuccessor(successorStates));
 }
Exemple #4
0
 public void Draw(object sender, EventArgs e)
 {
     Discovered.Reset();
     Draws += 1;
 }
Exemple #5
0
 public void Defeat(object sender, EventArgs e)
 {
     Discovered.Penalize();
     Defeats += 1;
 }
Exemple #6
0
 // Respond to victory, defeat, and draw events
 public void Victory(object sender, EventArgs e)
 {
     Discovered.Reward();
     Victories += 1;
 }
Exemple #7
0
 // Create a default Agent with no GoalTest
 public Agent()
 {
     Discovered = new Discovered();
 }