public MainWindow() { InitializeComponent(); this.gameProvider = new GameProvider(new MovesArrayAllocator()); this.chessboardControl.SetupGameProvider(gameProvider); this.worker = new BackgroundWorker(); this.redoMoves = new List<MoveWithDecision>(); this.worker.DoWork += new DoWorkEventHandler(worker_DoWork); this.worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); this.maxdepth = 5; this.debutsGraph = DebutsReader.ReadDebuts("simple_debut_moves", PlayerPosition.Down); }
public static DebutGraph ReadDebuts(string fileName, PlayerPosition whitePos) { FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader (fs); DebutGraph dg = new DebutGraph (); string str; while ((str = sr.ReadLine ()) != null) { if (string.IsNullOrEmpty (str)) continue; dg.AddMoves (whitePos, str.Split (',')); } sr.Close (); return dg; }
public static DebutGraph ReadDebuts(string fileName, PlayerPosition whitePos) { FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs); DebutGraph dg = new DebutGraph(); string str; while ((str = sr.ReadLine()) != null) { if (string.IsNullOrEmpty(str)) { continue; } dg.AddMoves(whitePos, str.Split(',')); } sr.Close(); return(dg); }