Translations:FP Homework 1/14/en

From Marek Běhálek Wiki
Revision as of 10:33, 18 November 2020 by FuzzyBot (talk | contribs) (Importing a new version from external source)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

5 - Turtle

Implement a function that will draw the movement of a turtle in a rectangular grid. It will be named draw and it will have one parameter - a list movements. Our turtle can move only horizontally or vertically. Each movement will be described by a pair (its type will be (Char, Int)), where the first character denotates a direction of this movement and the second its length. Possible directions are: left, right, up, and down. As the result, function draw returns a smallest possible rectangle with all turtle's movements. Each block from the grid will be represented with one character. If it was visited by our turtle, then it will be 'X', if it was not, then it will be ' '.