public void Incomplete()
        {
            int numSamples = 3;
            var sampler    = new MultiplayerPenaltyLinesHolePositionSampler(numSamples);

            sampler.Sample(new ProbabilisticResult <int>(7, 0.3));
            sampler.Sample(new ProbabilisticResult <int>(2, 0.5));

            var complete = sampler.IsComplete;

            Assert.False(complete);
        }
        public void CompleteByMajority()
        {
            int numSamples = 3;
            var sampler    = new MultiplayerPenaltyLinesHolePositionSampler(numSamples);

            sampler.Sample(new ProbabilisticResult <int>(6, 0.3));
            sampler.Sample(new ProbabilisticResult <int>(6, 0.5));

            var complete = sampler.IsComplete;

            Assert.True(complete);
        }
        public void SampleFails(int numSamples)
        {
            var sampler = new MultiplayerPenaltyLinesHolePositionSampler(numSamples);

            for (int i = 0; i < numSamples; i++)
            {
                var sample = new ProbabilisticResult <int>(i, 0.5);
                sampler.Sample(sample);
            }

            Assert.Throws <ArgumentException>(() =>
            {
                sampler.Sample(new ProbabilisticResult <int>(9, 0.5));
            });
        }
        public void CaseEarlyMajority()
        {
            int numSamples = 3;
            var sampler    = new MultiplayerPenaltyLinesHolePositionSampler(numSamples);

            sampler.Sample(new ProbabilisticResult <int>(2, 0.3));
            Assert.False(sampler.IsComplete);

            sampler.Sample(new ProbabilisticResult <int>(2, 0.8));
            Assert.True(sampler.IsComplete);

            var result = sampler.Result;

            Assert.AreEqual(2, result);
        }
        public void CaseMixed()
        {
            int numSamples = 3;
            var sampler    = new MultiplayerPenaltyLinesHolePositionSampler(numSamples);

            sampler.Sample(new ProbabilisticResult <int>(6, 0.4));
            Assert.False(sampler.IsComplete);

            sampler.Sample(new ProbabilisticResult <int>(5, 0.5));
            Assert.False(sampler.IsComplete);

            sampler.Sample(new ProbabilisticResult <int>(4, 0.3));
            Assert.True(sampler.IsComplete);

            var result = sampler.Result;

            Assert.AreEqual(5, result);
        }
        public void Sample(int numSamples)
        {
            var sampler = new MultiplayerPenaltyLinesHolePositionSampler(numSamples);

            for (int i = 0; i < numSamples; i++)
            {
                var sample = new ProbabilisticResult <int>(i, 0.5);
                sampler.Sample(sample);
            }
        }