示例#1
0
        /// <summary>
        /// Creates a new value for the token.
        /// </summary>
        public char CreateValue()
        {
            char c = (char)frequencies.GetRandomItem();

            if (frequencies[c] > 1)
            {
                frequencies[c]--;
            }

            return(c);
        }
示例#2
0
        /// <summary>
        /// Generates a token.
        /// </summary>
        public Token CreateToken(
            int row,
            int column)
        {
            // Generate the values
            TokenType type  = (TokenType)types.GetRandomItem();
            char      value = Game.Language.CreateValue();

            // Make sure we aren't near the bottom (that is being
            // rude to the player).
            if (row > Game.Board.Rows / 2)
            {
                type = TokenType.Normal;
            }

            // Decrease the probability
            if (types[type] > 1)
            {
                types[type]--;
            }

            // Return the results
            return(new Token(type, value, row, column));
        }