public List<Parameters> readAncestors() { sr = new StreamReader(path); String line; List<Parameters> list = new List<Parameters>(3); list.Add(new Parameters(0)); list.Add(new Parameters(0)); list.Add(new Parameters(0)); line = sr.ReadLine(); int i = 0; String[] words; //Continue to read until you reach end of file while (line != null) { words = line.Split(' '); list[i] = new Parameters(Int32.Parse(words[0]), Double.Parse(words[1]), Double.Parse(words[2]), Int32.Parse(words[3])); i++; if (i == 3) i = 0; line = sr.ReadLine(); } //close the file sr.Close(); return list; }
public AIPlayer(int cash,int id,Table t,Parameters p) { cards = new List<MyCard.Card>(2); this.cash = cash; this.id = id; this.table = t; this.folded = false; this.par = p; }
public Parameters crossMutate(Parameters father) { Parameters child = new Parameters(this.sorszam + 1); int inherit = rnd.Next(1,2); if (inherit == 1) child.winFactor = this.winFactor; else child.winFactor = father.winFactor; inherit = rnd.Next(1, 2); if (inherit == 1) child.betFactor = this.betFactor; else child.betFactor = father.betFactor; inherit = rnd.Next(1, 2); if (inherit == 1) child.style = this.style; else child.style = father.style; return child; }
public Parameters readLineFromFile(int i) { sr = new StreamReader(path); Parameters par = null; String line; String head; head = sr.ReadLine(); line = head; bool broken = false; int actual = 0; String[] words; while (head != null) { if (actual == i) { words = head.Split(' '); par = new Parameters(Int32.Parse(words[0]), Double.Parse(words[1]), Double.Parse(words[2]), Int32.Parse(words[3])); broken = true; break; } line = head; head = sr.ReadLine(); actual++; } if (!broken) { words = line.Split(' '); par = new Parameters(Int32.Parse(words[0]), Double.Parse(words[1]), Double.Parse(words[2]), Int32.Parse(words[3])); } sr.Close(); //close the file return par; }
public Parameters readFromLast() { sr = new StreamReader(path); String line; Parameters par = null; line = sr.ReadLine(); int i = 0; String[] words; //Continue to read until you reach end of file while ((line != null) && (line != "")) { words = line.Split(' '); par = new Parameters(Int32.Parse(words[0]), Double.Parse(words[1]), Double.Parse(words[2]), Int32.Parse(words[3])); i++; if (i == 3) i = 0; line = sr.ReadLine(); } //close the file sr.Close(); return par; }
public void writeToFile(Parameters p) { File.AppendAllText(path, p.sorszam + " " + p.winFactor + " " + p.betFactor + " " + p.style + Environment.NewLine); }