write a turtle graphics program in c that reads input from a file and prints result to console
Write a program that uses turtle graphics to draw an image described in the file input.txt. Turtle graphics simulates a turtle that sits on a 2D canvas. The turtle has a pen that it can raise or put on the canvas, and it can turn left, turn right, or move forward, possibly drawing a line if its pen is down. In this project, we will represent our canvas as a 2D array of characters, stored in a vector<vector<char>>. Initially, the canvas will be empty (all chars will be spaces), but when the pen is lowered (and as the turtle moves forward with the pen down), the turtle will change the characters to asterisks (*). The turtle should start at (0, 0) (the upper-left of the canvas), facing down, with its pen up.
Your program should read in commands from the file input.txt.The first line of input.txt will specify the number of rows and columns on the canvas, and the rest of the file will describe a sequence of moves for the turtle to take.
There are 5 commands, each with a 1-2 letter code:”PU” for pen up, “PD” for pen down, “TL” for turn left, “TR” for turn right, and “F” for forward. The forward command (F) should be followed by a nonnegative integer (the number of spaces to move forwards). All turns are 90 degrees. Commands will be separated by whitespace. The turtle should continue reading in and performing commands until it reads an invalid command. If the turtle is instructed to move forward in a way that would take it off the canvas, it should instead move forward to the edge of the canvas and stop there (then continue with the next command).
Your program should print the final canvas to the console, but it should not print anything else. You have been provided with some source code and an example input to help you get started. Feel free to define additional functions (e.g., forward()) when developing your solution.
Files used for input are input1 and input2 with their respective output1 and output2 on how they should print on the console. Source file is turtle.txt