Exemple #1
0
        public void Tutorial(ITutorialRunner tutorials)
        {
            Startup();

            _interactivity.Write("Welcome to MAGES! Press ENTER to to start the interactive tutorial ...");
            _interactivity.ReadLine();
            tutorials.RunAll(_interactivity, _engine.Scope, input => Evaluate(input, true));

            Teardown();
        }
Exemple #2
0
        private static Boolean TryToLearn(IInteractivity interactivity, IDictionary <String, Object> scope, Action <String> evaluate, ITutorialSnippet snippet)
        {
            var hints   = snippet.Hints.GetEnumerator();
            var success = true;

            do
            {
                if (!success)
                {
                    interactivity.Info(hints.Current);
                    interactivity.Write(Environment.NewLine);
                }

                var input = interactivity.ReadLine();
                evaluate.Invoke(input);
                success = snippet.Check(scope);
            }while (!success && hints.MoveNext());
            return(success);
        }
Exemple #3
0
 private Object PerformRead()
 {
     return(_interactivity.ReadLine());
 }