public static WordPost PrepareWord(string s, int number) { var oldS = s; s = s.Replace("-", ""); s = s.Replace("’", "'"); s = "alal" + s; var result = new WordPost {OriginalWord=oldS, Word = s, Seed = problem.sourceSeeds[number], ProblemId=problem.id }; result.Status = CheckWordAcceptance(result); return result; }
public static WordStatus CheckWordAcceptance(WordPost post) { foreach (var c in post.Word) { try { var dir=c.ToDirection(); } catch { return WordStatus.NotWord; } } var map = problem.ToMap(post.Seed); if (map.Unit.Unit.Period != 6) throw new Exception(); foreach (var c in post.Word) map=map.Move(c); if (map.IsOver) return WordStatus.Period; return WordStatus.OK; }