public static LearningTable loadData(string fileName) { if (!File.Exists(fileName)) { return(new LearningTable(new SortedDictionary <int, Data>())); } IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); LearningTable obj = (LearningTable)formatter.Deserialize(stream); stream.Close(); return(obj); }
public LearningAI(int mark) : base(mark) { tb = LearningTable.loadData("data"); rnd = new Random(); }