Exemple #1
0
        public IEnumerable <T> Generate(int max, T initialValue)
        {
            var visitor = new MarkovChainVisitor <T>(_possibleInitialStates[initialValue]);
            int count   = 0;

            while (visitor.Next() && count < max)
            {
                yield return(visitor.CurrentState.Value);

                count++;
            }
        }
        public void Dummy()
        {
            var state1 = new MarkovState <string>("State 1");
            var state2 = new MarkovState <string>("State 2");
            var state3 = new MarkovState <string>("State 3");

            state1.Links.Add(state2, 43);
            state1.Links.Add(state3, 100);

            var visitor = new MarkovChainVisitor <string>(state1);

            while (visitor.Next())
            {
                Console.WriteLine(visitor.CurrentState.Value);
            }
        }