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