コード例 #1
0
        private void Scramble(MahjongBoard board)
        {
            List <MahjongPair> reversed = new List <MahjongPair>();

            while (board.Tiles.Count > 0)
            {
                List <MahjongTile> removable = new List <MahjongTile>();
                removable.AddRange(ExtractRemovableTiles(board));
                while (removable.Count > 1)
                {
                    reversed.Add(MahjongPair.GetPair(removable));
                }
                foreach (MahjongTile tile in removable)
                {
                    board.Add(tile);
                }
            }
            for (int i = reversed.Count - 1; i >= 0; i--)
            {
                int typeIndex = random.Next() % types.Count;
                reversed[i].TileOne.Type = board.types[typeIndex];
                reversed[i].TileTwo.Type = board.types[typeIndex];
                board.Add(reversed[i].TileOne);
                board.Add(reversed[i].TileTwo);
            }
        }
コード例 #2
0
 public void SetHint()
 {
     if (Tiles.Count > 0)
     {
         SetNone();
         MahjongPair pair = GetHint();
         pair.TileOne.Select = MahjongSelect.Hint;
         pair.TileTwo.Select = MahjongSelect.Hint;
     }
 }