public void Puzzle_19B() { var detector = new SeaMonsterDetector(); detector.BuildRules(PuzzleRulesInput .Select(x => x.StartsWith("8:") ? "8: 42 | 42 +" : x) .Select(x => x.StartsWith("11:") ? "11: 42 31" + " | 42 42 31 31" + " | 42 42 42 31 31 31" + " | 42 42 42 42 31 31 31 31" /*+ * " | 42 42 42 42 42 31 31 31 31 31" + * " | 42 42 42 42 42 42 31 31 31 31 31 31" + * " | 42 42 42 42 42 42 42 31 31 31 31 31 31 31" + * " | 42 42 42 42 42 42 42 42 31 31 31 31 31 31 31 31" + * " | 42 42 42 42 42 42 42 42 42 31 31 31 31 31 31 31 31 31" + * " | 42 42 42 42 42 42 42 42 42 42 31 31 31 31 31 31 31 31 31 31" + * " | 42 42 42 42 42 42 42 42 42 42 42 31 31 31 31 31 31 31 31 31 31 31" + * " | 42 42 42 42 42 42 42 42 42 42 42 42 31 31 31 31 31 31 31 31 31 31 31 31" + * " | 42 42 42 42 42 42 42 42 42 42 42 42 42 31 31 31 31 31 31 31 31 31 31 31 31 31"*/ : x) .ToArray()); var ok = PuzzleDataInput.Sum(s => detector.TestStringWithRule(s, 0) ? 1 : 0); Assert.True(394 > ok, "too high"); Assert.Equal(389, ok); }
public void Puzzle_19A() { var detector = new SeaMonsterDetector(); detector.BuildRules(PuzzleRulesInput); var ok = PuzzleDataInput.Sum(s => detector.TestStringWithRule(s, 0) ? 1 : 0); Assert.Equal(184, ok); }