public static Puzzle ParseFrom(TextReader reader) { var metadata = PuzzleMetadata.ParseFrom(reader); var initialState = State.ParseFrom(reader); return(new Puzzle(metadata, initialState)); }
public static PuzzleMetadata FromDictionary(IDictionary <string, string> dict) { var result = new PuzzleMetadata(); foreach (var entry in dict) { switch (entry.Key) { case "Name": result.Name = entry.Value; break; case "AuthorName": result.AuthorName = entry.Value; break; case "AuthorEmail": result.AuthorEmail = entry.Value; break; case "CreationDate": result.CreationDate = DateTimeOffset.Parse(entry.Value); break; case "Difficulty": result.Difficulty = (PuzzleDifficulty)Enum.Parse(typeof(PuzzleDifficulty), entry.Value); break; } } return(result); }
public Puzzle(PuzzleMetadata metadata, State initialState) { Metadata = metadata; InitialState = initialState; }