Example #1
0
        /// <summary>
        /// Create a stack from the supplied list and run the supplied GusL string against it.
        /// If sucessful a prediction for the next element will be returned
        /// </summary>
        public GusStatus TryMakePrediction(List <int> sequence, string gusl, bool verbose, out int prediction)
        {
            prediction = 0;

            // Build a stack for this sequence
            var stack = new Stack <int>();

            for (int i = 0; i < sequence.Count; i++)
            {
                stack.Push(sequence[i]);
            }

            var result = _processor.Interpret(stack, gusl, verbose);

            if (result == GusStatus.OK)
            {
                prediction = stack.Peek();
            }
            return(result);
        }