Example #1
0
        static void PrintToFile()
        {
            var pp = MonteCarlo.CalculateAllProbabilities(100);

            using StreamWriter sw = new StreamWriter("results.csv");
            foreach (var(h, r) in pp)
            {
                sw.WriteLine($"{h[0].ToString()}, {h[1].ToString()}, {r},");
            }
        }
Example #2
0
        public static void Run()
        {
            var otherPlayers = InputNumber("How many other players are there?");

            Console.WriteLine("");

            var hand = new List <Card>()
            {
                InputCard("Please give the details of your first card."),
                InputCard("Please give the details of your second card."),
            };

            var cardsOnTable = InputNumber("How many cards are revealed on the table?");

            var table = new List <Card>();

            for (int i = 0; i < cardsOnTable; i++)
            {
                table.Add(InputCard($"{i + 1}. Please give the details of a card on the table."));
            }

            Console.WriteLine("Hand:");
            foreach (var c in hand)
            {
                Console.WriteLine(c);
            }

            Console.WriteLine("");

            Console.WriteLine("Table:");
            foreach (var c in table)
            {
                Console.WriteLine(c);
            }

            Console.WriteLine("\nThinking...\n");

            var p = MonteCarlo.CalculateProbability(hand, table, otherPlayers, 10000);

            Console.WriteLine(p);
        }