コード例 #1
0
        public static Tuple <int, long> Play(int players, int lastMarble)
        {
            var game   = new MarbleCircle();
            var player = 1;

            for (int currentMarble = 1; currentMarble <= lastMarble; currentMarble++)
            {
                game.Turn(player, currentMarble);
                player = player < players ? player + 1 : 1;
            }
            return(game.Winner());
        }
コード例 #2
0
        [TestCase(425, 70848, 413188)] // task1
        public void Day9Solutions(int p, int l, long ws)
        {
            var result = MarbleCircle.Play(p, l);

            Assert.AreEqual(ws, result.Item2, "winning score not match");
        }