Esempio n. 1
0
        public static int GenerateAllCombinations(int numCards, int combinations)
        {
            var mask = new MaskBits(numCards, combinations);
            var totalCombinations = BinaryOperations.GetNumberOfCombinations(52ul, 7ul);
            var numCombinations   = 0;

            using (var file = new StreamWriter(@"poker-all-" + combinations + "-hands.txt"))
            {
                while (!mask.IsParsingComplete)
                {
                    file.WriteLine(mask.ToUint64());
                    mask.Decrement();
                    numCombinations++;
                    ConsoleHelper.DrawProgressBar(numCombinations, totalCombinations);
                }
            }
            return(numCombinations);
        }
 public void GenerateAllCombinations_52bits_7combinations()
 {
     Assert.Equal(BinaryOperations.GetNumberOfCombinations(52, 7), BinaryOperations.GenerateAllCombinations(52, 7));
 }
 public void GenerateAllCombinations_8bits_3combinations()
 {
     Assert.Equal(BinaryOperations.GetNumberOfCombinations(8, 3), BinaryOperations.GenerateAllCombinations(8, 3));
 }
        public void GetNumberOfCombinations_0_0()
        {
            int result = 1;

            Assert.Equal(result, BinaryOperations.GetNumberOfCombinations(0, 0));
        }
        public void GetNumberOfCombinations_52_7()
        {
            int result = 133784560;

            Assert.Equal(result, BinaryOperations.GetNumberOfCombinations(52, 7));
        }
        public void GetNumberOfCombinations_8_8()
        {
            int result = 1;

            Assert.Equal(result, BinaryOperations.GetNumberOfCombinations(8, 8));
        }