A higher resolution is required to access the IDE
- 79
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
Your job is to implement a simple Logo interpreter that draws ASCII Art with a Turtle.In this challenge you will implement only a limited subset of Logo instructions, and the Turtle will move only in horizontal or vertical lines.
You should implement the following statements (case insensitive):
SETPC *
Multiple instructions on the same line are separated with semicolon
PD;FD 10
Turtle starts heading North, with the pen down and the initial symbol set to
The Turtle leaves a symbol in the starting position each time it moves with pen down, but not in the final position.
For example:
RT 90;PD;FD 1;PU;FD 1;PD;FD 1
Output:
All leading spaces should be removed only to the extent that the overall image is not affected. All unnecessary spaces at the end of the lines should be removed. For example:
FD 2;RT 90;FD 3
Output (there are no spaces in row 1 and row 2 after #):
Reference:
https://en.wikipedia.org/wiki/MSWLogo
Input
Line 1: An integer N, indicating the program's number of lines.
Next N lines: lines of text with Logo instructions.
Next N lines: lines of text with Logo instructions.
Output
The ASCII Art generated.
Constraints
1 ≤ N ≤ 100
angle: a positive integer multiple of 90.
angle: a positive integer multiple of 90.
Example
Input
1 RT 90;setpc #;PD;FD 1;PU;FD 1;PD;FD 1
Output
# #
A higher resolution is required to access the IDE