예제 #1
0
 public void Part1GamePlayWorksOnExample()
 {
     var(player1, player2) = CrabCombat.LoadGame("example1.txt");
     var(result1, result2) = CrabCombat.PlayGame(player1, player2);
     result1.ShouldBeEmpty();
     result2.ShouldBe(new List <int> {
         3, 2, 10, 6, 8, 5, 9, 4, 7, 1
     });
 }
예제 #2
0
 public void Part1GamePlayWorksOnRealInput()
 {
     var(player1, player2) = CrabCombat.LoadGame("input.txt");
     var(result1, result2) = CrabCombat.PlayGame(player1, player2);
     result1.ShouldBeEmpty();
     result2.ShouldBe(new List <int> {
         47, 30, 43, 22, 44, 31, 32, 17, 36, 24, 27, 9, 5, 2, 50, 37, 39, 21, 45, 15, 11, 1, 49, 41, 26, 14, 46,
         38, 25, 7, 48, 12, 23, 6, 34, 33, 16, 3, 42, 29, 40, 19, 35, 28, 20, 10, 18, 8, 13, 4
     });
 }
예제 #3
0
        public override string First()
        {
            string        filename = GetFilename();
            List <string> input    = System.IO.File.ReadAllLines(filename).ToList();

            PRINT = false;
            CrabCombat game = new CrabCombat(input);

            game.PlayGame();

            var result = game.Score();

            return(result.ToString());
        }
예제 #4
0
        public override bool Test()
        {
            string        filename = GetTestFilename();
            List <string> input    = System.IO.File.ReadAllLines(filename).ToList();

            PRINT = false;
            CrabCombat game = new CrabCombat(input);

            game.PlayGame();
            var result = game.Score();

            bool testSucceeded = result == 306;

            return(testSucceeded);
        }
예제 #5
0
 public void ScoreCalculatorWorksOnRealInput()
 {
     var(player1, player2) = CrabCombat.LoadGame("input.txt");
     var(result1, result2) = CrabCombat.PlayGame(player1, player2);
     CrabCombat.CalculateScore(result2).ShouldBe(35397);
 }
예제 #6
0
 public void ScoreCalculatorWorksOnExample()
 {
     var(player1, player2) = CrabCombat.LoadGame("example1.txt");
     var(result1, result2) = CrabCombat.PlayGame(player1, player2);
     CrabCombat.CalculateScore(result2).ShouldBe(306);
 }