public void LoadlongTermMermory(String file) { NeaReader reader = new NeaReader(new StreamReader(file + ".MQ")); while (reader.Peek() != -1) { List <VirusMemory> memories = new List <VirusMemory>(); VirusBoard startState = new VirusBoard(); VirusBoard endState = new VirusBoard(); Move action = new Move(); double reward; double significance; string data; data = reader.ReadLine(); NeaReader r = new NeaReader(data); significance = double.Parse(r.ReadUntil(":")); while (r.Peek() != -1) { startState.Load(r.ReadUntil(":")); endState.Load(r.ReadUntil(":")); action.Load(r.ReadUntil(":")); reward = double.Parse(r.ReadUntil(":")); memories.Add(new VirusMemory(startState, action, endState, reward)); } //memory = new VirusMemory(startState, action, endState, reward); LongTermMemory.Add(new VirusMemoryEpisode(memories.ToArray(), significance)); //new VirusLongTermMemory(memory, significance)); } reader.Close(); }
public void Load(string save) { NeaReader reader = new NeaReader(save); players = byte.Parse(reader.ReadUntil(";")); winner = byte.Parse(reader.ReadUntil(";")); int size = int.Parse(reader.ReadUntil(";")); board = new byte[size, size]; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { board[i, j] = byte.Parse(reader.ReadWord()); } } }
private void LoadDepFiles() { //string[] filePaths = null; string file = null; departments = new Dictionary <string, string[]>(); //config data try { file = "Personale liste Know How.txt"; NeaReader r = new NeaReader(new StreamReader(file)); while (r.Peek() != -1) { char next = (char)r.Peek(); while (char.IsWhiteSpace(next)) { r.ReadLine(); next = (char)r.Peek(); } string departmentname = "ERROR"; List <string> strings = new List <string>(); while (r.Peek() != -1) { next = (char)r.Peek(); if (!char.IsWhiteSpace(next)) { if (departmentname != "ERROR") { departments.Add(departmentname, strings.ToArray()); strings.Clear(); } departmentname = r.ReadWord().ToUpper(); r.ReadLine(); } else { r.SkipWhiteSpace(); r.ReadUntil('\t'); //løn nr r.SkipWhiteSpace(); r.ReadUntil('\t'); // efternavn r.SkipWhiteSpace(); r.ReadUntil('\t'); // fornavn r.SkipWhiteSpace(); r.ReadUntil('\t'); // afdeling if (r.Peek() == -1) { break; } r.SkipWhiteSpace(); brugernavn = r.ReadWord(); // brugernavn strings.Add(brugernavn.ToUpper()); r.ReadLine(); } } departments.Add(departmentname, strings.ToArray()); } r.Close(); } catch (FileNotFoundException fnf) { StreamWriter w = new StreamWriter("Personale liste Know How.txt"); w.Write("Fill this with data"); w.Close(); } catch (Exception e) { } foreach (string afdeling in departments.Keys) { combobox_Afd.Items.Add(afdeling); } combobox_Afd.Items.Add("ALLE AFDELINGER"); }
public void LoadlongTermMermory(String file) { NeaReader reader = new NeaReader(new StreamReader(file + ".MQ")); while (reader.Peek() != -1) { List<VirusMemory> memories = new List<VirusMemory>(); VirusBoard startState = new VirusBoard(); VirusBoard endState = new VirusBoard(); Move action = new Move(); double reward; double significance; string data; data = reader.ReadLine(); NeaReader r = new NeaReader(data); significance = double.Parse(r.ReadUntil(":")); while (r.Peek() != -1) { startState.Load(r.ReadUntil(":")); endState.Load(r.ReadUntil(":")); action.Load(r.ReadUntil(":")); reward = double.Parse(r.ReadUntil(":")); memories.Add(new VirusMemory(startState, action, endState, reward)); } //memory = new VirusMemory(startState, action, endState, reward); LongTermMemory.Add(new VirusMemoryEpisode(memories.ToArray(), significance));//new VirusLongTermMemory(memory, significance)); } reader.Close(); }