Пример #1
0
        private IList <Room> BuildRooms(MazeDetail detail)
        {
            var rooms = new List <Room>();

            var numRooms = _randomNumberGenerator.Between(detail.MinNumRooms, detail.MaxNumRooms);

            for (var i = 0; i < numRooms; i++)
            {
                var room = _roomBuilder.BuildRoom(detail.BlocksPerRoom, detail.TilesPerBlock);
                rooms.Add(room);
            }

            return(rooms);
        }
Пример #2
0
    /// <summary>
    /// shuffle the remaining cards in the deck
    /// </summary>
    public void Shuffle(IRandomNumberGenerator numberGenerator)
    {
        int shuffleBaseIndex = topCardIndex;

        while (shuffleBaseIndex < cards.Count)
        {
            int indexToSwap = numberGenerator.Between(shuffleBaseIndex, cards.Count - 1);

            //swap items
            Card tempCard = cards[indexToSwap];
            cards[indexToSwap]        = cards[shuffleBaseIndex];
            cards[shuffleBaseIndex++] = tempCard;
        }
    }