Exemple #1
0
        public void FullE2ETest()
        {
            var inputString = @"5
1
RS
3
R
P
S
7
RS
RS
RS
RS
RS
RS
RS
3
R
P
P
7
P
P
P
R
R
R
P";
            var io          = new TestIOStub(inputString);

            CaseSolver.Run(io);

            var output =
                @"Case #1: P
Case #2: IMPOSSIBLE
Case #3: P
Case #4: PS
Case #5: PS";

            io.Output.Should().BeEquivalentTo(output.Split(new [] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries));
        }
Exemple #2
0
        public static void Run(IGoogleCodeJamCommunicator io = null)
        {
            InOut = io ?? new GoogleCodeJam2018Communicator();
            var lines      = InOut.ReadStringInput(out numberOfCases);
            var cases      = new CaseSplitter().Configure_TakingNFromFirstValPlusOne().GetCaseLines(lines);
            var results    = new List <string>();
            var caseNumber = 0;

            foreach (var caseLines in cases)
            {
                caseNumber++; //1-indexed.
                var parsedCase = new CaseInput(caseLines);
                var solver     = new CaseSolver(parsedCase);
                var result     = solver.Solve();

                var resultText = result.ToString();

                results.Add($"Case #{caseNumber}: {resultText}");
            }

            InOut.WriteOutput(results);
        }