/// <summary> /// print turtle's starting state /// </summary> /// <param name="turtle"></param> public static void Print(Turtle.Library.Models.Turtle turtle) { var contextGreen = new ColorContext(new Green()); contextGreen.ContextInterface(); Console.WriteLine(startString.Replace("{x}", turtle.Position.X.ToString()).Replace("{y}", turtle.Position.Y.ToString()).Replace("{dir}", turtle.Direction.ToString())); var contextWhite = new ColorContext(new White()); contextWhite.ContextInterface(); Console.WriteLine(new string('-', 50)); }
/// <summary> /// print turtle changed its direction /// </summary> /// <param name="dir"></param> public static void Print(Directions dir) { var contextGreen = new ColorContext(new Green()); contextGreen.ContextInterface(); Console.WriteLine(rotate.Replace("{to}", dir.ToString())); var contextWhite = new ColorContext(new White()); contextWhite.ContextInterface(); Console.WriteLine(new string('-', 50)); }
/// <summary> /// print a text /// </summary> /// <param name="text"></param> public static void Print(string text) { var contextGreen = new ColorContext(new Green()); contextGreen.ContextInterface(); Console.WriteLine(text); var contextWhite = new ColorContext(new White()); contextWhite.ContextInterface(); Console.WriteLine(new string('-', 50)); }
public static void Print(Point pointFrom, Point pointTo) { ColorContext context = new ColorContext(new Yellow()); context.ContextInterface(); string combinePointFrom = $"({pointFrom.X},{pointFrom.Y})"; string combinePointTo = $"({pointTo.X},{pointTo.Y})"; string printText = movedFromTo.Replace("{from}", combinePointFrom).Replace("{to}", combinePointTo); Console.WriteLine(printText); ColorContext contextWhite = new ColorContext(new White()); contextWhite.ContextInterface(); Console.WriteLine(new string('-', 50)); }
/// <summary> /// print turtle moved from point a to point b /// </summary> /// <param name="pointFrom"></param> /// <param name="pointTo"></param> public static void Print(Point pointFrom, Point pointTo) { var context = new ColorContext(new Yellow()); context.ContextInterface(); var combinePointFrom = $"({pointFrom.X},{pointFrom.Y})"; var combinePointTo = $"({pointTo.X},{pointTo.Y})"; var printText = movedFromTo.Replace("{from}", combinePointFrom).Replace("{to}", combinePointTo); //var printText = text.Replace("{from}", combinePointFrom).Replace("{to}", combinePointTo); //if (action != null) printText = $"{printText} - {action}"; Console.WriteLine(printText); var contextWhite = new ColorContext(new White()); contextWhite.ContextInterface(); Console.WriteLine(new string('-', 50)); }