Exemple #1
0
        public void SetNextShuffle()
        {
            iShuffle = iShuffle.GetNext();

            GenerateShuffleList();
            UpdateShuffleIcon();
        }
Exemple #2
0
 public Tissue2DFactory(ICellFactory cellFactory, IGermFactory germFactory, IShuffle shuffler)
 {
     _tissue      = ImmutableDictionary <Location, ICell> .Empty;
     _cellFactory = cellFactory ?? throw new ArgumentNullException(nameof(cellFactory));
     _germFactory = germFactory ?? throw new ArgumentNullException(nameof(germFactory));
     _shuffler    = shuffler ?? throw new ArgumentNullException(nameof(shuffler));
 }
        internal static void AllNValuesCanChangePositions(this Assert _, IShuffle <ValuePriorityPair <int> > shuffle)
        {
            var elements = new ValuePriorityPairs <int>
            {
                new ValuePriorityPair <int>(1, 1),
                new ValuePriorityPair <int>(2, 2),
                new ValuePriorityPair <int>(3, 3),
                new ValuePriorityPair <int>(4, 4),
                new ValuePriorityPair <int>(5, 5),
            };

            var value1Set = new HashSet <int>();
            var value2Set = new HashSet <int>();
            var value3Set = new HashSet <int>();

            for (var i = 0; i < _iterations; i++)
            {
                var shuffled = shuffle.Shuffle(elements, 3).ToList();
                value1Set.Add(shuffled[0].Value);
                value2Set.Add(shuffled[1].Value);
                value3Set.Add(shuffled[2].Value);
            }

            Assert.AreEqual(elements.Count(), value1Set.Count);
            Assert.AreEqual(elements.Count(), value2Set.Count);
            Assert.AreEqual(elements.Count(), value3Set.Count);
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterSetShuffler"/> class.
 /// </summary>
 /// <param name="characterSetProvider">An instance of the <see cref="ICharacterSetProvider"/>.</param>
 /// <param name="shuffle">An instance of <see cref="IShuffle{T}"/> of type
 /// <see langword="char"/>.</param>
 public CharacterSetShuffler(
     ICharacterSetProvider characterSetProvider,
     IShuffle <char> shuffle)
 {
     this.characterSetProvider = characterSetProvider;
     this.shuffle = shuffle;
 }
Exemple #5
0
 public DeckFactory(IShuffle shuffler)
 {
     m_isShuffler = shuffler;
 }
        public static IEnumerable <T> Shuffle <T>(this IEnumerable <T> elements, IShuffle shuffleAlgorithm)
        {
            var shuffledSet = shuffleAlgorithm.Shuffle(elements);

            return(shuffledSet);
        }
Exemple #7
0
 public FileScrambler(IShuffle <FileInfo> fileShuffler, IShuffle <DirectoryInfo> directoryShuffler)
 {
     this.fileShuffler      = fileShuffler;
     this.directoryShuffler = directoryShuffler;
 }
Exemple #8
0
 public GameService(IGameRepository repository, IShuffle shuffle)
 {
     _repository   = repository;
     _cardShuffler = shuffle;
     _random       = new Random();
 }
 public SolitareCryptoProvider(IShuffle shuffleAlgorithm)
 {
     _shuffleAlgorithm = shuffleAlgorithm;
 }