예제 #1
0
        public void ValidateShuffle()
        {
            List <Tile>   original = Enumerable.Range(0, 24).Select(value => new Tile(value)).ToList();
            List <Tile>   shuffled = new List <Tile>(original);
            TilesShuffler shuffler = new TilesShuffler();

            shuffler.Shuffle(shuffled);
            Assert.NotEqual(original, shuffled);
        }
예제 #2
0
        private List <Tile> GetLegalBoardTiles(int size)
        {
            int         numberOfTiles = size * size - 1;
            List <Tile> tiles         = Enumerable.Range(0, numberOfTiles).Select(i => new Tile(i)).ToList();;

            tiles.Add(new Tile(null));
            do
            {
                tilesShuffler.Shuffle(tiles);
            } while (!legalBoardValidator.Validate(tiles, size));

            return(tiles);
        }