コード例 #1
0
ファイル: Coin.cs プロジェクト: shfitzy/RandomStuff
        public double CalculateRating(int flips, int targetScore)
        {
            int targetNumHeads = CalculateTargetNumHeads(flips, targetScore);

            if (targetNumHeads > flips)
            {
                rating = 0;
            }
            else
            {
                rating = SmotMathCache.GetBinomialCoefficientSummation(flips, targetNumHeads, odds);
            }

            return(rating);
        }
コード例 #2
0
ファイル: CoinFlipGame.cs プロジェクト: shfitzy/RandomStuff
        static void Main(string[] args)
        {
            CoinFlipGame game = new CoinFlipGame();

            int numFlips = 100;

            SmotMathCache.GenerateBinomialCoeffCache(numFlips);

            for (int i = 0; i <= 100; i++)
            {
                Coin coinA = new Coin("A", 1, i * 0.01);
                Coin coinB = new Coin("B", 2, 0.5);

                game.RunSimulations(numFlips, 1000, coinA, coinB);
            }
        }