public void Tutorial() { Startup(); _interactivity.IsPromptShown = false; _interactivity.Write("Welcome to MAGES! Press ENTER to to start the interactive tutorial ..."); _interactivity.Read(); _interactivity.IsPromptShown = true; Tutorials.RunAll(_interactivity, _engine.Scope, input => Evaluate(input, true)); Teardown(); }
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.Read(); evaluate.Invoke(input); success = snippet.Check(scope); }while (!success && hints.MoveNext()); return(success); }