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