private IEnumerable <string> GetClosedRealtions(RelationArray array) { IRelationInterpreter interpreter = new ActualInterpreter(); for (int i = 0; i < array.Width; i++) { for (int j = 0; j < array.Height; j++) { if (!interpreter.IsOpen(array[i, j])) { yield return(i + "x" + j); } } } }
private void SaveLabyrinth_Click(object sender, RoutedEventArgs e) { IRelationInterpreter interpreter = new ActualInterpreter(); Labyrinth lab = lc.Labyrinth; string text = lab.Width + "x" + lab.Height + "|"; text += lab.Target.TopLeft.X + "x" + lab.Target.TopLeft.Y + "|"; text += string.Join(";", GetClosedRealtions(lab.H)) + "|"; text += string.Join(";", GetClosedRealtions(lab.V)); try { File.WriteAllText("Data.txt", text); } catch { } }