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(); }
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); }
private Object PerformRead() { return(_interactivity.ReadLine()); }